Finding Index Of Repeating Section - InfoPath Dev
in

InfoPath Dev

Finding Index Of Repeating Section

Last post 05-04-2009 10:33 PM by swathip. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-01-2008 08:01 AM

    Finding Index Of Repeating Section

    Hopefully this has an easy answer.... and thanks in advance.

     I have a repeating section with a button associated with it...

    text1 | text2 | text3 | text4 | text5 |  Button

    so when you add another section, the button replicates.

    text1 | text2 | text3 | text4 | text5 |  Button

    text1 | text2 | text3 | text4 | text5 |  Button

    text1 | text2 | text3 | text4 | text5 |  Button

    text1 | text2 | text3 | text4 | text5 |  Button

    When you CLICK the button, it takes you to a search view, and you can select some data to populate the text fields.

     

    My question is, is there some method of knowing which row, or instance, you came from?

    Like an index or something?

     

     

  • 02-02-2008 12:05 AM In reply to

    Re: Finding Index Of Repeating Section

    What I typically do is add a flag field to my repeating data.

    Set the flag empty or it could be a boolean and false.

    Since your button is bound with each row a set field action when it is selected will set the flag to a value for the current row.

    Then you can use the filter [flag=true] whenever you want to reference that row from outside the group.

    Make sure when you return you set all the flags back to blank or false.

    This way you always know the current choice.

  • 05-04-2009 07:03 PM In reply to

    • Jerome
    • Not Ranked
    • Joined on 05-04-2009
    • Posts 2

    Re: Finding Index Of Repeating Section

    Hello, I have a simiar issue where I have a button, a textbox, a dropdown list (like the schema below) and also a repeating field that I am using to save the data returns by the search button and fill the dropdown list.
    textbox
    Search button
    dropdown list

    textbox xPath: /my:Master/my:group3/my:gpInitiatives/my:txtPoOwner

    dropdown list xPath: /my:Master/my:group3/my:gpInitiatives/my:InitiativePO

    repeating field xPath: /my:Master/my:group3/my:gpInitiatives/my:PrOwner

    • the issue is that how do I know what button from what section I am clicking on ?
    • how to make sure my button is looking at the right textbox value to search for and returns the dataset to right repeating field to display in the right dropdown list ?

    Today no matter how many sections I have, every actions will automatically look for and display the value in the first section.

    Any help would be more than appreciated.

     

  • 05-04-2009 07:37 PM In reply to

    • Jerome
    • Not Ranked
    • Joined on 05-04-2009
    • Posts 2

    Re: Finding Index Of Repeating Section

    Well looks like I found the answer to my questions:

    in my button click event I need to use the "e.Source.SelectSingleNode" to return the corresponding fields.

  • 05-04-2009 10:33 PM In reply to

    Re: Finding Index Of Repeating Section

    Hi,

    You can get the current row index using the following expression.

    count(current()/preceding-sibling::my:group2) +1

    Use the above expression in an expression box placed in the repeating section.

     

    Swathip
    www.ggktech.com
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.