Add or Count Values of XML Elements
Complete these steps to add the values of an element in an XML file. Counting the number of elements is very similar. The distinction is in Step 7.
- Start the eFORMz Composer, open the project file, and load an XML data file.
- Determine which element in the XML you want to add.
- This example adds all the values of the <quantity> element. In the Viewer, right click quantity > Add Variable.
- In the Name field, add Sum to the end of the variable name so it is clear that this number is a sum. The following image shows the original values:
- In the Data Node field, move the last two nodes, order/quantity to the Node Filter field.
- Change the Transfer method field from Normal to Sum of child elements’ data, and then click OK. The following image shows the final values:
- The value of quantitySum is the sum of the <quantity> elements. To count the number of elements, change the transfer method from Sum of child elements’ data to Count of child elements.