Setting the field value of the Current Node (repeating section) - InfoPath Dev
in

InfoPath Dev

Setting the field value of the Current Node (repeating section)

Last post 05-03-2016 02:39 AM by Swapnil. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-13-2009 12:36 PM

    Setting the field value of the Current Node (repeating section)

    Hey all,

    I have run into a brick wall here... While i have overcome many of my previous issues, I've done pretty good at figuring out Infopath....

    ...except this.

     I have a Repeating Section (Detail) which syncs to the Repeating Table (master). 

    Lets say I have 3 fields (e1, e2, e3) in the master table, with 2 rows of data.   We will call this repeating section 'MyStuff'
    |=====|=====|====|   (1)    (master view)
    |=====|=====|====|   (2)    (master view)
       e1       e2       e3

    Now, I have another section that is a repeating table called 'MyOtherStuff' with just fields of data

    |=====|=====|====|btn|   (1)
    |=====|=====|====|btn|   (2)
    |=====|=====|====|btn|   (3)
    |=====|=====|====|btn|   (4)
       d1       d2       d3

     So, how would i grab the value of say row 3 value d1 and put that into row 2 field e2

    So far, i have put a rule on the 'btn' in 'myOtherStuff' which pulls the value:
         current()/my:d2     and I can set any field to that value. (say field1 under the root node) 

    Figure 1 is my Master, I have not listed the Details view.. but say i had a field in my Details view that i wanted to set the value from r3/d2 to

    When i execute the rule , it sets every e2 to the value to r3/d2, instead of just the 1 cell.

    Thanks for the help, and I hope i explained this completely.

     

    ~Doc

     

  • 05-14-2009 06:08 PM In reply to

    Re: Setting the field value of the Current Node (repeating section)

    Hi --

    There is a post by Jimmy Rishe in this thread that I think explains what you want to do -- specify a filter on the target field for a rule. I use this technique when I need to and I really think it is slick...

    Hilary Stoupa

  • 05-15-2009 05:55 AM In reply to

    Re: Setting the field value of the Current Node (repeating section)

    I have tried that and it worked well, but It only applied to the first row.  The field that is setting the repeating row value is coming from another repeating table using Webservice as a query.  I am using the rules in the button to take that field value from repeating table and set it in a master/Detail repeating table.  Is there something extra that needs to added if another row is generated?  It is not always the case that there will be more than one row.  I am really hoping to stay away from code and I am using IP2003. 

  • 05-15-2009 09:38 AM In reply to

    Re: Setting the field value of the Current Node (repeating section)

    If I understand the original post in this thread, you want to set the value of a field in the selected row of the master/detail section, correct?

     If so, please check out the attached template.

     The trick here is that I am using a special formula in a rule on the button to store the current row number in a hidden field:

     xdXDocument:GetNamedNodeProperty(/my:myFields/my:group1, "CTRL1_5", 1)

    This formula will change slightly depending on your setup.  Generally the "/my:myFields/my:group1" part corresponds to the parent of the repeating node in the master/detail section and the "CTRL1_5" part is the master/detail section's ViewContext id (you can find this by opening the master/detail's controls and going to the advanced tab).

    Then I use the trick from Hilary's link to set the value of a field in just one row, but this time it's just a little trickier:

    <xsf:assignmentAction targetField="my:group1/my:group2[position() = /my:myFields/my:group1/@my:currentRow]/my:field3" expression="&quot;Yay!&quot;"></xsf:assignmentAction>

    The underlined part tells the rule to just set the value in the row whose row number is equal to the value in /my:myFields/my:group1/@my:currentRow, and since the previous rule has just stored the current row number in that field, this means that only the field in the selected row gets set.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-03-2016 02:39 AM In reply to

    Re: Setting the field value of the Current Node (repeating section)

     Hey Jimmy,Your post is life saving man.Though my requirement was little different,but your work helped me alot.

    Thanks buddy.

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