Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How to identify if a data node exist?

Avatar

Level 4

Hi,

If a form is binded to a schema, and when the xml is supplied to the form how to identify an optional node in the xml is available or not.

for example if I have a XML input like below

<root>

     <childTable>         

          <childRow>

               <child1>

               <child2>

          </childRow>

          <childRow>

               <child1>

               <child2>

          </childRow>

     </childTable>

</root>

is it possible to identify if the childTable node is present in the xml input.

The code xfa.datasets.data.root.childTable if used fails when the childTable is not present in the input xml?

Please let me know if there is a way to identify if the input xml has  a specified node. Assuming that we know the path of the node in the xml structure.

Regards -

Ashok Deivaisgamani

1 Reply

Avatar

Former Community Member

Hi Ashok,

Could you please try this?

var nodeCheck = xfa.resolveNode("$record.childTable");

if(nodeCheck != null)

{

     app.alert("Node Exists");

}

else

{

     app.alert("Node Not Avaliable");

}

Thanks,

VJ