Problem binding to directly to data connection

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

21-06-2017

I have a data connection in my form and I need to loop through the data within the node items. On the form ready event I have:

var a = xfa.resolveNode("$record.message.node[*]...").value

The loop should replace the * with a number starting at 0 and run till done. It does not work. I have tried to modify this with resolveNodes and other attempts.

I was able to cheat a bit and create a dynamic table and load the data into the table first, then use the loop to go through the data within the fields. It works but this is an extra step, that I should be able to avoid.

Any help would be greatly appreciated.

the script I would like to use is below. Something is not working in setting the variable directly to the data node.

var vDescItems = xfa.resolveNode("$record.message.controlActProcess.reasonOf[*].detectedIssueEvent.value.code").value

for(i=0; i<vDescItems.length; i++)

{

    if (vDescItems.item(i).rawValue == "C53566")

    {

     do something

     }

}

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,078 posts

Correct reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,078 posts

Correct reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

21-06-2017

Hi there,

to accomplish the the code you have provided, first you should be using the resolveNodes() method instead of resolveNode()

Also if this is still not working try accessing the value property only in the loop instead of accessing it right after calling resolveNodes()

Hope this help!

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

21-06-2017

You were completely correct. My code was a bit messed up. I properly placed the .value and cleaned up the code. It is working correctly now. Thanks very much for all the help!!!!

Avatar

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,078 posts

Correct reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile

Avatar
Springboard
MVP
Magus069
MVP

Likes

143 likes

Total Posts

1,078 posts

Correct reply

155 solutions
Top badges earned
Springboard
Validate 1
Ignite 3
Ignite 1
Establish
View profile
Magus069
MVP

21-06-2017

When using resolveNodes method, you specify value and as I can see in your loop you specify rawValue... you should access the value only once.. either in your resolveNodes statement or within the loop

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

21-06-2017

Thank you for the reply. I did attempt to use xfa.resolveNodes. That still returned no value. I ran a test by setting similar to below:

var vDescItems = xfa.resolveNode("$record.message.controlActProcess.reasonOf[1].detectedIssueEvent.code.code").value

TextField1.rawValue = vDescItems

the test yielded the correct node data. However when I used a loop to provide data in that node, I received no returned value. the only way I was able to accomplish this was to populate a table with the data and then loop through the table to get the results. It works but it is not as clean as I would like to see.

Also I did try to use the .value property in the loop and that did not work either.