Filtering issue repeating table in repeating section - InfoPath Dev
in

InfoPath Dev

Filtering issue repeating table in repeating section

Last post 04-07-2010 03:14 PM by bayeo. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-05-2010 06:30 AM

    • bayeo
    • Not Ranked
    • Joined on 06-27-2006
    • Posts 2

    Filtering issue repeating table in repeating section

    Hi, I have an IP2007 form that has a repeating table as part of a repeating section.  One field of the table is a drop down list using a secondary data source (sharepoint list).  I am filtering the list so when a 'CostOrg' is selected in the table it will not be available when inserting a new row in the current repeating table.  This works fine - but when I insert a new section the new instance of the repeating table filters out all entries from previous section as well - I want the new section to have all entries available again.  I suspect I need current() function somewhere but have tried everything with no luck...

    Here is what I am using for filter:
    not(@CostOrgCode = xdXDocument:get-DOM()/my:myFields/my:group2/my:group3/my:group4/my:group10/my:group11/my:CostOrg)

    Group3 is the repeating section

    Group11 is the repeating table

    Thanks in advance for any help.

  • 04-07-2010 08:22 AM In reply to

    Re: Filtering issue repeating table in repeating section

    You are correct, you cannot do this without using current().

    The problem with your approach is that it is starting at the root node of your main DOM and looking for ANY my:CostOrg that is part of ANY my:group11 table. This is why you are experiencing what you are. When you start from the root node, there's not much you can do to prevent that unless you can filter for a specific repeating section (my:group3[2]). To do this easier, you use current().

    The biggest trouble people (including myself) have with current() is understanding just what node that represents so that you can build an appropriate XPath from it. The data source task pane often gives you a clue by BOLDING the specific node that is the current node--there are some rare exceptions to this, but in general this is the case. So in your case my:group11 is bold, and is the current node.

    Thus your filter would be this:

    not(@CostOrgCode = current()/../my:group11/my:CostOrg)

    Note that I go up one level from my:group11 to the table container, then back down into the table and into the my:CostOrg field. This is important because current() doesn't actually represent the TABLE itself, but the specific ROW of the table that you are currently on. Thus, to compare against all of the rows in the table, you have to get outside to the table container, then back so you can compare against each row.

    I hope that was enough to make sense to you can unstick yourself in the future too.

    Good luck,

    Greg

  • 04-07-2010 03:14 PM In reply to

    • bayeo
    • Not Ranked
    • Joined on 06-27-2006
    • Posts 2

    Re: Filtering issue repeating table in repeating section

    Thank you Greg - works like a charm!  And thanks also for the explanation - that WILL help me in the future...

     

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