Filtering a Repeating Table via another Repeating Field - InfoPath Dev
in

InfoPath Dev

Filtering a Repeating Table via another Repeating Field

Last post 07-24-2019 08:51 AM by dlafbsci. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-23-2019 04:12 PM

    Filtering a Repeating Table via another Repeating Field

    I have a repeating table of data that I'm filtering through a series of rules that hide rows based on whatever condition. Right now most of the filtering occurs like this: "Data" does not contain "Filter", then Hide this control. In this case "Filter" is just a single text field of user input, "Data" is a repeating table from a SharePoint secondary data connection.

    So, in my repeating table structure containing dog, cat, horse, bike, and car in its 5 rows, typing "car" into "Filter" would remove the car row. My question is there a way I can turn my "Filter" into some sort of repeatable data itself, whether that be another repeating table, a numbered list, etc. and still have the rules apply? When I try this only the first piece of data is accounted for in the rules. A "Filter" repeating table of "1) dog 2) cat 3) car" will only filter out "dog" from my "Data" table.

    Now I know when composing a rule you have the option of selecting "Any occurrence of" when it comes to repeating tables, however it seems you're only allowed to make this selection if it's in the first "slot" of the rule so to speak. Basically I want to write a rule that states ("Data" does not contain any occurrence of "Filter"), but you don't have the any/all/number options in the second slot of the rule builder.

    I also can't make out if it's possible to write it in reverse such that any occurrence of "Filter" (appears in? is present in?) "Data"

    I would assume that if what I'm trying to do were possible it must have to be done through xpath.

     

    Let me know if what I'm saying makes sense or if I need to attach pictures or an example form. :)

     

     

  • 07-24-2019 08:25 AM In reply to

    Re: Filtering a Repeating Table via another Repeating Field

    Maybe because I'm using equals here instead of contains - but try this sample form and see if this is what you mean. Save locally, right click, select design - the condition to hide rows that I added was simple - but let me know if you have to use contains in your scenario and I can see what that needs to look like.
    Hilary Stoupa

  • 07-24-2019 08:51 AM In reply to

    Re: Filtering a Repeating Table via another Repeating Field

     Thanks for your response as always :) 

    I believe I do need to use contains, as the data I'm running my filters on are concatenated strings that may be made of any words in any order, or even short paragraphs. My data might say "Dave, Jim, Sarah" or "Sarah, Jim, Dave" and then I'd run a filter rule that states if Data does not contain user entry "Dave", then hide. Then perhaps I want to further filter, so I insert a filter item, and further filter out "Jim".  

    To use your example "contains" would also give the freedom to type in "america" and filter out both "americanum" and "americana"

    In your example simply changing the rule from equals to contains causes the rule to only apply to the first filter field, which has been my experience so far.

     

    My solution thus far has just been to manually place five separate textbox filters on my form and run all separate "does not contain" filter rules on my data set. Ideally though I would like it to be a repeating table so I can repeat the filtering ad infinitum and not limit my users.

    Edit: 

    Basically how do I (or can I?) turn this field1 path into something that points to any occurrence of field 1, and not just the first occurrence?

    not(contains(d:Data, xdXDocument:get-DOM()/my:myFields/my:group1/my:group2/my:field1)) 

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