I would like to bind data to a table only on the condition that one of the child tags has a certain value.
For example, let's say my XML file had the following structure:
<tag>
<condition>1</condition>
....
</tag>
I want to bind only if the condition tag has a value of '1'. Does anyone have an idea how this can be done?
Thanks
Solved! Go to Solution.
You need to use SOM predicates in your Data Binding expression. For example the binding expression for your entire table with the common parent of <Table> let's say, you could put:
$.Table.[tag.condition.value=='1']
Remember the '.' (period) after Table since that what tells the XFA parser to expect a boolean to determine whether to bind or not.
If you require more detail, please provide more xml and your form names/hierarchies.
Kyle
You need to use SOM predicates in your Data Binding expression. For example the binding expression for your entire table with the common parent of <Table> let's say, you could put:
$.Table.[tag.condition.value=='1']
Remember the '.' (period) after Table since that what tells the XFA parser to expect a boolean to determine whether to bind or not.
If you require more detail, please provide more xml and your form names/hierarchies.
Kyle
Thanks that resolves my question, but I also want to know how I would be able to use SOM predicates in javascipt code
I tried:
xfa.resolveNode("xfa.datasets.data.tag.[condition.value=='1'].TestValue").value
For an XML structured in this manner, except with multiple tags with different condition values:
<tag>
<condition>1</condition>
<TestValue>0</TestValue>
....
</tag>
....
Views
Replies
Total Likes
This will return all the tag nodes whose condition element equals 1:
xfa.resolveNodes('$record.tag.[condition=="1"]')
You can also use:
XMLData.applyXPath(xfa.data, "RootNode.tag[condition='1']")
if you're more familiar with xPath expressions. It's also faster (when you get up to around 10,000 entries).
Kyle
Thanks
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies