locked
List View (filter) based on multiple fields RRS feed

  • Question

  • Hello. I've created an infopath form where a Project Manager is able to name 12 project members in various departments using a people picker field for each project member field. Is there a way to filter the list so that it shows only the projects the individual project members are involved in based on whether he/she shows up in any of the 12 member fields? The members are not necessarily the ones creating the list item. I am limited to 10 filters in the view settings in the sharepoint list so that won't work. Any assistance would be greatly appreciated.

    Have a great weekend.

    Cory

    Friday, March 1, 2013 10:45 PM

Answers

  • Hi Cory,

    I’m sorry, from that way you can filter by current user, but also can’t add more than 10 parameters. The only way to add more than 10 filters is to use xpath by check add xslt filtering, then click edit.

    I have a try on my server, please check the following steps.

    1. Create a parameter by click parameters.
    2. On the data view parameters dialog, click new parameter, name Param1. From parameter source, select server variable, set LOGON_USER as server available name. Then click ok.
    3. Go to filter, on filter criteria dialog, check add xslt filtering, then click edit.
    4. Add the following xslt code.

    [@people.title=$Param1 or @people1.title=$Param1 or @people2.title=$Param1 or @people3.title=$Param1 or @people4.title=$Param1 or @people5.title=$Param1 or @people6.title=$Param1 or @people7.title=$Param1 or @people8.title=$Param1 or @people9.title=$Param1 or @people10.title=$Param1 or @people11.title=$Param1]

    Best Regards.


    Kelly Chen
    TechNet Community Support

    • Marked as answer by Surferdog Saturday, March 9, 2013 12:03 AM
    Wednesday, March 6, 2013 3:28 AM

All replies

  • Hi Cory,

    You can’t add more than 10 filters in a view through UI .This is by design . And the max number of indexed column is 10. So I would suggest adding filter parameters using SharePoint Designer .You can do like following:

    1.Open view page on which the list exist in SharePoint Designer ,such as the Allitem.aspx page under Tasks list.

    2.Choose the list which you want to add  filters on .Then click Data View>Filters or Parameters .In this way you can add more than 10n filters on a list .

    Best Regards.


    Kelly Chen
    TechNet Community Support

    Monday, March 4, 2013 8:21 AM
  • Thank you for you response. When I add the filters in SPD for each people picker field I only get 4 options for comparison. Is Null, Not Null, Contains and Begins With. Should I be selecting something along these lines?

    Ex: Sales Member Contains [Current User] or

    Thank you for your assistance.

    Cory


    • Edited by Surferdog Monday, March 4, 2013 6:30 PM spelling
    Monday, March 4, 2013 6:29 PM
  • Hi Cory,

    To filter by current user, you should create a list view with data form web part. Delete the xslt list view web part, then click insert, dataview, empty data source, then select the field which you want to display.

    Go to code view, locate the XSL Stylesheet and find the dvt_apos parameter declaration. Add in the UserID parameter just after it, 

    <xsl:param name="dvt_apos">'</xsl:param>

    <xsl:param name="UserID" />

    Then in filter, when you add user field, you will see current user. Please check.

    Best Regards.


    Kelly Chen
    TechNet Community Support

    Tuesday, March 5, 2013 3:08 AM
  • Yes, I see [Current User]. When I create the filter with the 12 project member filelds I get an error...Encountered an improper argument. I am creating the filter by creating 12 clauses and it looks like this (with 12 clauses not the 3 shown). Maybe i'm doing something wrong.

    Thanks again for assisting.

    Tuesday, March 5, 2013 4:29 PM
  • Hi Cory,

    I’m sorry, from that way you can filter by current user, but also can’t add more than 10 parameters. The only way to add more than 10 filters is to use xpath by check add xslt filtering, then click edit.

    I have a try on my server, please check the following steps.

    1. Create a parameter by click parameters.
    2. On the data view parameters dialog, click new parameter, name Param1. From parameter source, select server variable, set LOGON_USER as server available name. Then click ok.
    3. Go to filter, on filter criteria dialog, check add xslt filtering, then click edit.
    4. Add the following xslt code.

    [@people.title=$Param1 or @people1.title=$Param1 or @people2.title=$Param1 or @people3.title=$Param1 or @people4.title=$Param1 or @people5.title=$Param1 or @people6.title=$Param1 or @people7.title=$Param1 or @people8.title=$Param1 or @people9.title=$Param1 or @people10.title=$Param1 or @people11.title=$Param1]

    Best Regards.


    Kelly Chen
    TechNet Community Support

    • Marked as answer by Surferdog Saturday, March 9, 2013 12:03 AM
    Wednesday, March 6, 2013 3:28 AM
  • Thank you for sticking with me on this Kelly. When you say "set LOGON_USER as server available name" do you mean Server Variable Name? I'm not seeing any filtering on my name (login) when applying the filter so I must be doing something wrong...just not sure what. Here's my xlst filter code.

    [@Marketing_x0020_Member=$Param1 or @Sales_x0020_Member=$Param1 or @R_x0026_D_x0020_Member=$Param1 or @Engineering_x0020_Member=$Param1 or @Purchasing_x0020_Member=$Param1 or @Planning_x0020_Member=$Param1 or @Logistics_x0020_Member=$Param1 or @QA_x0020_Member=$Param1 or @Finance_x0020_Member=$Param1 or @Sales_x0020_Logistics_x0020_Member=$Param1 or @Production_x0020_Member=$Param1 or @Co_x002d_Pack_x0020_Member=$Param1]

    Update: I seem to be having an issue with the parameter. When I hard code my display name in place of Param1 the filter works. Any ideas?




    • Edited by Surferdog Thursday, March 7, 2013 8:52 PM
    • Marked as answer by Surferdog Saturday, March 9, 2013 12:03 AM
    • Unmarked as answer by Surferdog Saturday, March 9, 2013 12:03 AM
    Thursday, March 7, 2013 5:04 PM
  • Okay....finally sorted the parameter issue. I just had to match the text case output of LOGON_USER to the output of my list fields. Thanks alot Kelly for your help!

    Cory

    Saturday, March 9, 2013 12:03 AM
  • Hi Can you provide me steps what changes you have done to make this working?\

    I dont ahve a 'add xslt filtering' at all. I tried to add field values directly with your parameter passing approach but it did not work.

    Please provide instructions to increase more than 10 criteria.

    Tuesday, August 26, 2014 10:38 PM