locked
Filteringing Data View Web Part based on a custom column RRS feed

  • Question

  • I'm following this article,
    http://blogs.msdn.com/sharepointdesigner/archive/2008/03/26/sharepoint-conference-building-a-sharepoint-designer-mashup-part-1.aspx

    I can get that working fine, however, I'm trying to figure out how to filter based on a custom field/column, not ID.  Do I still select Query String as the Parameter Source?  The field contains numbers and hyphens, if that matters.  And yes, both lists' items have that same matching fields and is unique.
    • Moved by Mike Walsh FIN Wednesday, July 1, 2009 5:50 AM spd q (From:SharePoint - Development and Programming)
    Tuesday, June 30, 2009 7:56 PM

Answers

  • Hi,

     

    Yes, you should create a custom display form for ListA, here are the detailed steps:

     

    Firstly, you should create a custom display form for ListA(create custom list form)

    1.    Open your site in SharePoint Designer, browse to your ListA and open the ‘DispForm.aspx’ web form.

    2.    Right-click the list form and select “Web part properties”, in the Layout section, select “Hidden”.(we should hide the original form and then create a new list form)

    3.    Go Insert > SharePoint Controls > Custom List Form.

    4.    In the List or Document Library Form dialog, select your ListA, content type and type of form (select display item form).

    5.    Click OK and a display form is added with controls representing all the fields from the list.

    Insert a data view web part and set the data source to ListB(create a data view)

    6.    Under the new display form, on the Data View menu, click Insert Data View.

    7.    In the Data Source Library task pane, locate the ListB, click it and then click Show Data.

    8.    In the Data Source Details task pane, click the fields that you want to insert in the Data View.

    9.    Click Insert Selected Fields as, and then click Multiple Item View to insert the selected data into the Data View.

    Filter the data view by web connection the custom display form(connect two data view)

    10.  In the ListB data view, click Web Part Connections on the Common data view tasks.

    11. In the Choose the action on the source Web Part to use for this connection list, click Get filter value from, and then click Next.

    12. In the Choose the page containing the Web Part for the connection section, click Connect to a Web Part on this page, and then click Next.

    13. In the Target Web Part list, click ListA, in the Target Action, select Send row of data to.

    14. Set List A Book Number = List B Book Number.

    Hope it can help you.


    Xue-Mei Chang
    • Proposed as answer by Manishrao Patil Tuesday, July 7, 2009 6:23 AM
    • Marked as answer by zenicanin Tuesday, July 7, 2009 8:26 PM
    Tuesday, July 7, 2009 1:58 AM
    Moderator

All replies

  • SPD questions go to Design/Customization.

    Moving this
    WSS FAQ sites: http://wssv2faq.mindsharp.com and http://wssv3faq.mindsharp.com
    Total list of WSS 3.0 / MOSS 2007 Books (including foreign language) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx
    Wednesday, July 1, 2009 5:50 AM
  • Hi,

     

    In this article, it uses a query string parameter to filter the data view; this is because that the ID parameter is always in the query string section of the URL of the SharePoint Form. If you want to filter data view using a custom column, you can add a filter in the data view (Common Data View Tasks list, click Filter).

     

    For more information, you can refer to: http://office.microsoft.com/en-us/sharepointdesigner/HA101030411033.aspx

     

    Hope it helps.

     


    Xue-Mei Chang
    Thursday, July 2, 2009 6:41 AM
    Moderator
  • Thanks for the response.

    I understand the way it says on the office website, but I need to filter it by comparing 2 columns from each list.  Not just Book Number = "0055", but rather List A Book Number = List B Book Number.  And the data view would be on DispForm.aspx on Library A...  Any thoughts on how to achieve that?  I'm sure I'd need a parameter or join lists?
    Thursday, July 2, 2009 12:56 PM
  • Hi,

     

    I understand you that when you access ListA DispForm.aspx page, there is a data view web part which data source is List B, you only want the data view to display the item which BookNumber is equal to the BookNumber of the item in ListA DispForm page.

     

    If I am right, you can use web part connection to filter the data view:

    1. Firstly, you should create a custom display form for ListA(create custom list form)

    2. Insert a data view web part and set the data source to ListB.

    3. Filter the data view by web connection the custom display form (in the data view>click “common data view tasks”>web part connections>choose the action”Get filter values form”).

     

    Hope it can help you.


    Xue-Mei Chang
    Friday, July 3, 2009 4:38 AM
    Moderator
  • Thanks for explaining that.  Do I have to create a custom display form?  Also, can you clarify third step a little more?  Do I use default dispForm.aspx and customForm, or just custom form?  Where  do I actually set to display only BookNumber A = BookNumber B?

    Thanks again for the help.  Much appreciated!
    Monday, July 6, 2009 3:49 PM
  • Hi,

     

    Yes, you should create a custom display form for ListA, here are the detailed steps:

     

    Firstly, you should create a custom display form for ListA(create custom list form)

    1.    Open your site in SharePoint Designer, browse to your ListA and open the ‘DispForm.aspx’ web form.

    2.    Right-click the list form and select “Web part properties”, in the Layout section, select “Hidden”.(we should hide the original form and then create a new list form)

    3.    Go Insert > SharePoint Controls > Custom List Form.

    4.    In the List or Document Library Form dialog, select your ListA, content type and type of form (select display item form).

    5.    Click OK and a display form is added with controls representing all the fields from the list.

    Insert a data view web part and set the data source to ListB(create a data view)

    6.    Under the new display form, on the Data View menu, click Insert Data View.

    7.    In the Data Source Library task pane, locate the ListB, click it and then click Show Data.

    8.    In the Data Source Details task pane, click the fields that you want to insert in the Data View.

    9.    Click Insert Selected Fields as, and then click Multiple Item View to insert the selected data into the Data View.

    Filter the data view by web connection the custom display form(connect two data view)

    10.  In the ListB data view, click Web Part Connections on the Common data view tasks.

    11. In the Choose the action on the source Web Part to use for this connection list, click Get filter value from, and then click Next.

    12. In the Choose the page containing the Web Part for the connection section, click Connect to a Web Part on this page, and then click Next.

    13. In the Target Web Part list, click ListA, in the Target Action, select Send row of data to.

    14. Set List A Book Number = List B Book Number.

    Hope it can help you.


    Xue-Mei Chang
    • Proposed as answer by Manishrao Patil Tuesday, July 7, 2009 6:23 AM
    • Marked as answer by zenicanin Tuesday, July 7, 2009 8:26 PM
    Tuesday, July 7, 2009 1:58 AM
    Moderator
  • For some reason, I can't connect to the List Form Web Part.  When I go into web part connections for the data view, select get Filter Value from, click next, there's nothing to select.  Both radio buttons are grayed out.  If I right click on List Form Web Part, and go to Web Part Connections, it says The Web Part Does Not Support Connections.  Any ideas why it's saying that?

    Thanks!
    Tuesday, July 7, 2009 1:51 PM
  • Nevermind.  Doh!  I had inserted a List Form Web Part instead of a Custom List Form Web Part.  Now I have to figure out how to format this custom one so that people fields, date fields, etc... show up like in the original one.  But I won't bother you with that stuff. :)  Thanks for all your help!  It's greatly appreciated!
    Tuesday, July 7, 2009 8:26 PM