Expand my Community achievements bar.

Loop through Iterative section and get the value of field

Avatar

Level 2

Hi

I need help in getting the valueo f Iterative field through javascript

I have xml structule like

<EqipList>

     <EuipDetails>

          <tag1></tag1>

          <tag2></tag2>

     </EuipDetails>

     <EquipAdd>

          <Building></Building>

          <Street></Street>

     </EquiAdd>

I need to access the value of Building also I need to get the count of EquipAdd. I have set the binding at row level ans binding for each tag as none.

I want to display the values by javascript.

Can somebody help.

Thanks,

Smitha

3 Replies

Avatar

Level 10

You can try with the below syntax.

Thanks

Srini

Avatar

Level 10

Hi Srini,

Just wondered why you do the second resolveNode, i,e,  var oEquipAddNode = xfa.resolveNode("$record.EquipAdd[" + i + "]");

I would have done var oEquipAddNode = oEquipAddNodes.item(i);

As you have already done a resolveNode with  var oEquipAddNodes = xfa.resolveNodes("$record.EquipAdd[*]");

Is this a faster way?

Also I don't think you need the -1 in the for loop as this will mean you will miss the last EquipAdd

Regards

Bruce

Avatar

Level 10

Bruce,

     Thank you for prompting my mistake.. Yes, I should have removed the -1 in the for loop..or place a <= sign for that.

     I agree with you that using the item(i) should definitely be a faster way compared to resolving the node again.

Thanks

Srini