locked
How to use DVWP to filter multiple columns in a document library RRS feed

  • Question

  • I am not new to SP, but newer to developing in SP, so I need some help please.

    I am attempting to convert my company away from nested folders on SP. Elsewhere I saw a way to add multiple custom columns to a document library and then use a different web part (I thought the Form Web Part, but that only lets you filter on one column at a time) to filter the document library using those columns.

    Ex: I have three columns:

    * Market - with the checkbox choices being Employer, Public, Payer, and GovEduLab. A document could be a part of all, some or one of those markets.
    * Product - with the checkbox choices being Care Solutions and Behavioral Solutions. A document could be a part of all, some or one of those markets.
    * Process - again, checkbox choices being Account Planning, Commissions, Contracts, etc. And again, the doucment could be a part of all, some or one of those markets.

    I want to create something that will allow the user to use some kind of "form" to filter find any document that is a Public-Care Solutions-Contract document and only show thsoe documents in the library.

    This is what I have been trying to make it look like, but I am not tied to this:

    <br/>
    
    
    
    <div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_">
    
    <table>
    
    <tr>
    
    <td align="center" valign="bottom">Market</td>
    
    <td align="center" valign="bottom">Product</td>
    
    <td align="center" valign="bottom">Process</td>
    
    <td> </td>
    
    </tr>
    
    <tr>
    
    <td align="center" valign="top">
    
    <select name="VarMarket">
    
    <option value="">Any</option>
    
    <option value="Employer">Employer</option>
    
    <option value="Public">Public</option>
    
    <option value="Payer">Payer</option>
    
    <option value="GovEduLab">GovEduLab</option>
    
    </select>
    
    <td align="center" valign="top">
    
    <select name="VarProduct">
    
    <option value="">Any</option>
    
    <option value="Care Solutions">Care Solutions</option>
    
    <option value="Behavioral Solutions">Behavioral Solutions</option>
    
    <td align="center" valign="top">
    
    <select name="VarProcess">
    
    <option value="">Any</option>
    
    <option value="Account Planning">Account Planning</option>
    
    <option value="Commission">Commission</option>
    
    <option value="Contracts">Contracts</option>
    
    <option value="Customer Audits">Customer Audits</option>
    
    <option value="Customer Meeting">Customer Meeting</option>
    
    <option value="Customer References">Customer References</option>
    
    <option value="Customer Reporting Data Control (CDC)">Customer Reporting Data 
    
    Control (CDC)</option>
    
    <option value="Customer Termination">Customer Termination</option>
    
    <option value="Implementation">Implementation</option>
    
    <option value="Member Success Stories">Member Success Stories</option>
    
    <option value="Non Disclosure Agreement">Non Disclosure Agreement</option>
    
    <option value="Performance Guarantee Results Collection">Performance Guarantee 
    
    Results Collection</option>
    
    <option value="Pre-Sales Analytics">Pre-Sales Analytics</option>
    
    <option value="Pricing Performance Gurantees">Pricing Performance Gurantees</option>
    
    <option value="Proposal/Proposal Follow Up">Proposal/Proposal Follow Up</option>
    
    <option value="Rosetta Quick Reference">Rosetta Quick Reference</option>
    
    <option value="Solution Design">Solution Design</option>
    
    <option value="Special Account Instructions(SAI) Navigation">Special Account 
    
    Instructions(SAI) Navigation</option>
    
    <option value="Other">Other</option>
    
    <td align="center" valign="middle"><input type="button" value="Search" 
    
    onclick="javascript:_SFSUBMIT_"/>
    
    </td>
    
    </tr>
    
    </table>
    
    </div>
    
    
    
    

    I tried to follow this example: http://andyparkes.co.uk/blog/index.php/2008/10/31/creating-a-multi-column-search-form-in-sharepoint-v3-with-sharepoint-designer/, but couldn't figure out how to tie the data view into the form or vice versa. I got lost once I got to the instructions:

    Every time I tried this I got an empty "Control ID" box - meaning when I went to click on the box, to see the options for my IDs, there was nothing in there.

    I am working in WSS3 and I have SPD2007

    Anyone have any ideas?

    Thanks in advance,
    Eric

     

    Give your parameter a name (i’m using “SearchValue”) and change the parameter source to CONTROL and the CONTROL ID to the ID of your FORM WEB PART (If your following these instructions or haven’t changed the ID it’s more than likely T1) and click K.


    Later:

    Oops, to clarify, the text after my name is the instructions to which I was referring closer to the end.

    Additionally, obviously, using a Form Web Part, I could get it to do just Market, or Just Process, or just Product. But it won't let you join three.

    • Moved by Mike Walsh FIN Saturday, April 2, 2011 6:44 AM SPD 2007 question (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    • Edited by Mike Walsh FIN Saturday, April 2, 2011 6:45 AM Section starting from Later: added. Was the text of a "reply" from the same poster less than an hour later. In such cases with no replies between always Edit your original post
    Friday, April 1, 2011 7:42 PM

Answers

  • Hi Eric,

    Before you get to the form, make sure your dataview works the way you want it to. For example,

    1. Create a dataview
    2. Add 3 QueryString Parameter for the fields that you want to filter
    3. Apply Filter on the dataview that uses the value of the querystring parameter. It should look something like this:

        Market equal to querystring_param_market AND
        Product equal to querystring_param_product AND
        Process equal to querystring_param_process AND

    4. Now, test your dataview in the browser by supplying querystring values manually and make sure you're getting expected result.
    5. Once that's out of the way, now all you have to do is get your Form Web Part to build a querystring based on user selection and pass it to the appropriate url

    Hope that helps...

     


    Pman
    http://www.pmansLab.com/
    • Marked as answer by Leoyi Sun Friday, April 8, 2011 9:26 AM
    Saturday, April 2, 2011 6:01 PM

All replies

  • Hi Eric,

    Before you get to the form, make sure your dataview works the way you want it to. For example,

    1. Create a dataview
    2. Add 3 QueryString Parameter for the fields that you want to filter
    3. Apply Filter on the dataview that uses the value of the querystring parameter. It should look something like this:

        Market equal to querystring_param_market AND
        Product equal to querystring_param_product AND
        Process equal to querystring_param_process AND

    4. Now, test your dataview in the browser by supplying querystring values manually and make sure you're getting expected result.
    5. Once that's out of the way, now all you have to do is get your Form Web Part to build a querystring based on user selection and pass it to the appropriate url

    Hope that helps...

     


    Pman
    http://www.pmansLab.com/
    • Marked as answer by Leoyi Sun Friday, April 8, 2011 9:26 AM
    Saturday, April 2, 2011 6:01 PM
  • Thanks for the help. It turns out I needed both your help and the patience to read through my code...I had forgotten </select> in two places. But, I couldn't have fixed it without the comments on the querystring and filter. So thank you.

    Thank you...


    Eric

    • Edited by Mike Walsh FIN Friday, April 8, 2011 5:05 PM The question in this thread has been answered. Ask your new question in a new thread.
    Friday, April 8, 2011 4:59 PM
  • Moderator Note:

    Pick up your deleted text here http://social.technet.microsoft.com/Forums/en-US/Offtopic/thread/3cd6d0c1-f10b-4d44-bbae-7e5cf6795586

    Let me know there when you have done so and I will then delete that thread.

    (This is a trial of this "service" so please do reply so I can delete it)


    SP 2010 "FAQ" (mainly useful links): http://wssv4faq.mindsharp.com/default.aspx
    WSS3/MOSS FAQ (FAQ and Links) http://wssv3faq.mindsharp.com/default.aspx
    Both also have links to extensive book lists and to (free) on-line chapters
    Friday, April 8, 2011 5:11 PM