none
Data view, linked source and filtering

    Question

  • I have created a page with a data view in Sharepoint Designer. The data view displays data from a linked source I have set up. I have inserted the fields I want as "Single item view". This will show a page with the first element in the linked data source, and I can click forth and back to show the next element.

    However, I want to display a specific element, based on an ID in the querystring. Anyone know how to accomplish this?

    The reason for me doing this is that I have two list. One list with customers, and one list with orders. I want to view the data for one customer together with the orders on this customer.

    WSS 3.0
    Monday, November 09, 2009 4:48 PM

Answers

All replies

  • Did you try connecting the two webparts?

    If you want to filter the data view using a query string, it shouldn't be too difficult.

    1. In SPD, click on the ">" icon/button beside the data view. The "Common Data View Task" menu will pop up.
    2. Click on "Parameters..." 
    3. Create a new parameter and choose "Query String" from the Parameter Source
    4. Click OK and click on "Filter" from the "Common Data View Task"
    5. Now filter your data view using your query string parameter.

    Hope the above helps.

    Monday, November 09, 2009 6:56 PM
  • Hi, thanks for your suggestion. however, I only have one web part on the page. The reason for this is that I want to customize the look on the page significantly, to be more precise I am making a printer-friendly versjon. Else I could have used two web parts and connected them.
    Monday, November 09, 2009 10:11 PM
  • In that case, you can just create a query string parameter and filter your data view using that parameter. The steps I mentioned above should help you with this.

    Then all you need is passing the value in the query string to this page and the data view will be filtered automatically.
    Tuesday, November 10, 2009 12:05 AM
  • Hi,
    I already tried this, but it didn't work.

    have both tried to create single item view and multiple item view and filter on a querystring parameter that I made..
    Tuesday, November 10, 2009 8:09 AM
  • Not sure what might have gone wrong, but it should work fine. What does your query string look like?

    I don't think it matters but try it on a data view that is not a linked source. Use one of your own sharepoint list. Does that work for you?

    Tuesday, November 10, 2009 2:59 PM
  • I, thanks for taking the time to reply to this. As you suggested, it works when I have a data view which shows data from a regular list, but it doesnt work if I choose a linked source to display data from.

    Maybe this is an easier way to explain what I am trying to do (this is not exactly what I will do but the principle is the same.)

    I have one list with orders and one list with customers. When creating an order, I choose a customer from the customer list.

    I then want to display a printer friendly view of the order, like this:

    OrderID
    Other_info_from_order
    Customer name (from order)
    Customer address (from customer list)
    Order item (from order)
    Wednesday, November 11, 2009 10:07 AM
  • Are you going to a separate page for the printer friendly view?  If so, you can pass the ID on the Query String like this:

    http://servername/sitename/pagename.aspx?ID=1

    Then in your DVWP, add a Parameter of type Query String to grab the ID value.  You can then use this value in your filter.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services
    Wednesday, November 11, 2009 2:50 PM
  • Are you going to a separate page for the printer friendly view?  If so, you can pass the ID on the Query String like this:

    http://servername/sitename/pagename.aspx?ID=1

    Then in your DVWP, add a Parameter of type Query String to grab the ID value.  You can then use this value in your filter.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services

    Yes, but I want to display data from two lists, and I am therefore using a linked source in the data view. Then the passing of variables via query string does not work, do you have any suggestions?

    See my previous post where the data from two list items from two different lists needs to be merged in a printer friendly view.
    Wednesday, November 11, 2009 3:08 PM
  • It's totally doable, but you'll probably need to dive into the XSL.  When you get into Aggregate Data Sources, SharePoint Designer doesn't get you too far.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc - jQuery Library for SharePoint Web Services
    • Marked as answer by audunms Thursday, November 12, 2009 2:00 PM
    Thursday, November 12, 2009 3:55 AM
  • Hi,
    I made this by replacing the default value (1) of the variable FirstRow in the template dvt_1 with a parameter that gets its value from querystring.

    Thursday, November 12, 2009 2:00 PM
  • And that was after creating a data view of the linked source of type Single Item View.

    Thursday, November 12, 2009 3:14 PM