Filtering on Repeating Table - InfoPath Dev
in

InfoPath Dev

Filtering on Repeating Table

Last post 03-20-2013 02:15 PM by Hilary Stoupa. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 03-20-2013 08:45 AM

    • ps1138
    • Not Ranked
      Male
    • Joined on 02-21-2013
    • Rochester, NY
    • Posts 12

    Filtering on Repeating Table

    I was able to create a filter on a repeating table which only shows items when they are assigned to the current user of the form by setting a filter using the username() function.
    On another form I have a requirement to allow multiple people to view and update the items in a repeating table that are assigned to a team of people rather than just an individual (see example below)

    Unfiltered Repeating Table
    Item 1 Team A
    Item 2 Team A
    Item 3 Team B
    Item 4 Team C
    Item 5 Team A

    Desired Result (as viewed by any member of Team A)
    Item 1 Team A
    Item 2 Team A
    Item 5 Team A

    Is possible to do this type of filtering and if so does anybody have any suggestions on how to accomplish this?

  • 03-20-2013 08:56 AM In reply to

    Re: Filtering on Repeating Table

    Hi-

    Can you provide more information? I'm not sure whether there's a qRules command to help in this scenario but we can dig deeper to find out.

    Where is the data coming from? (Is is in the main data source, or is it coming from a secondary data source)

    Is this a browser form? Is the filtering (that you've already created) happening on the data connection itself, or in the view (perhaps via conditional formatting)?

    If you'd like, you could also attach a form via the Options tab when replying. Thanks.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-20-2013 09:29 AM In reply to

    • ps1138
    • Not Ranked
      Male
    • Joined on 02-21-2013
    • Rochester, NY
    • Posts 12
    The data in the repeating table is coming from a secondary data source (which is a SharePoint List). The form is an InfoPath form and the current filter is being applied to the data connection itself when the form loads. I’ve attached a copy of the form for you to look at.
  • 03-20-2013 10:38 AM In reply to

    Re: Filtering on Repeating Table

    Hi,

    Before calling the Get Staff data connection (which happens on load right now), you can set the value of the filter you need. So in SPGetStaff, set the value of /dfs:myFields/dfs:queryFields/q:SharePointListItem_RW/q:Team and then query the data connection. You'll get only the filtered values.

    Hope this helps!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-20-2013 11:03 AM In reply to

    • ps1138
    • Not Ranked
      Male
    • Joined on 02-21-2013
    • Rochester, NY
    • Posts 12

    Re: Filtering on Repeating Table

    That is what I was doing when filtering the repeating table for one user because I get get the current username of the person opening the form and use it as the filter. How can I assign the default value of the user's team to use that as the filter? I guess what I'm trying to figure out is what do I set the default value of set the value of /dfs:myFields/dfs:queryFields/q:SharePointListItem_RW/q:Team to?

  • 03-20-2013 11:09 AM In reply to

    Re: Filtering on Repeating Table

    You can't set a default value on /dfs:myFields/dfs:queryFields/q:SharePointListItem_RW/q:Team .

    You can set the value of that field via a rule, then query the data connection.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-20-2013 11:20 AM In reply to

    • ps1138
    • Not Ranked
      Male
    • Joined on 02-21-2013
    • Rochester, NY
    • Posts 12

    Re: Filtering on Repeating Table

    I am doing that already for the user. Sorry I am getting my terminology mixed up. What do I set the default value of /dfs:myFields/dfs:queryFields/q:SharePointListItem_RW/q:Team to? I know how to set the value I just can't seem to figure out how to get the team for the user opening the form to use as the value for the filter.

  • 03-20-2013 11:29 AM In reply to

    Re: Filtering on Repeating Table

    Oh I see.

    I honestly don't know. Where do you store the relationship between People and Teams? SQL? On a ShP List? In Active Directory?

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-20-2013 11:47 AM In reply to

    • ps1138
    • Not Ranked
      Male
    • Joined on 02-21-2013
    • Rochester, NY
    • Posts 12

    Re: Filtering on Repeating Table

    Back to my original question. Is possible to filter information in a repeating table for a person based on their association to a team and if so any suggestions on how to accomplish this?

    I would prefer that the relationship between the user and the team stored in SharePoint.
  • 03-20-2013 12:15 PM In reply to

    Re: Filtering on Repeating Table

    I'm confused, because the original table shows a relationship between Items and Teams, not Users and Teams.

    Where do you store the relationship that tells us which Users belong to which Teams?

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-20-2013 12:40 PM In reply to

    Re: Filtering on Repeating Table

    Forgive me for barging in.

    If you create a list that associates users to teams, you should be able to do this.

    Add a data connection to your new list (with user and teams). The condition on the repeating table would be something along the lines of:

    If Team is not equal to Team (from SharePoint List) where User (from SharePoint List) is equal to userName() (InfoPath function), hide this row.

    I'm attaching a simple sample that just uses values in the form / default values for this. Save it locally, right click and select design to open in design mode. From there you can preview. Set any of the fields in the first column of the top table to your user name - rows in the second table should show / hide accordingly

     

    Hilary Stoupa

  • 03-20-2013 01:46 PM In reply to

    • ps1138
    • Not Ranked
      Male
    • Joined on 02-21-2013
    • Rochester, NY
    • Posts 12

    Re: Filtering on Repeating Table

    I figured it out by combining Ernosto's and Hillary solution. Below is what I did.

    1. I created a new SharePoint list called Teams and associated each user to a team
    2. I added the list Teams as a seconary data source to the form
    3. I added a new field called myTeam to the main datasource that with a default value from the Teams datasource with a filter set where team = to userName()
    4. Then I created a rule on form load and before I get the data for the repeating table I apply the team filter by setting the team value = to myTeam

    Thank you both for your help.

  • 03-20-2013 02:15 PM In reply to

    Re: Filtering on Repeating Table

     Hey, perfect, glad you have it working the way you want!

    Hilary Stoupa

Page 1 of 1 (13 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.