Setting Repeating Table field relative to current row

O

oiTomas

InfoPath newbie here, so any help would be greatly appreciated!

I have some code I am using to set the value of a field in a repeating table
based on a database call. The call to the DB works fine and the value is
updated correctly in the first row. However, when I create a second or third
row, the code always updates the field in the first row. Also, when I create
a second or third row, the value I am setting programatically nulls out.
Somehow I am not specifying the update relative to the current row. Question
is: How do I specify the update to target the row the user is curretnly
working on and not the first?

This seems to be the offending line of code:

XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2/my:qtr_status").text = overall_status


BTW, the structure of the local data source looks like this:

myFields
currentdate
group1
group2
field2
qtr_status

Any help would be appreciated!
 
R

Rajitha

Hi,
If you write like that every time you are going to assign to first row only.
Instead of that do like this. Get the node from sample data xml and add
values to that node and then add it as a child node to the repeating node.
Hope this helps
 
S

Swathi (GGK Tech)

Hi,
Put an on after change for the repeating group. And write the following code
line instead of the one you are using.
e.site.selectSingleNode(“my:qtr_statusâ€). text = overall_status;

Here e.site gives the current row
 
O

oiTomas

Thanks for the suggestions they got me thinking in the correct direction. I
changed the line to what follows and it fixed the problem!

eventObj.Site.selectSingleNode("../my:qtr_status").text = overall_status

Thanks much!
Tom
 
U

utkarsh2012

Hey Rajitha!

Can you please explain this point? I am trying to do the same by Infopath UI
and NOT by managed code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top