To extract the fields, I use a “Repeat Step” that iterates over all “POS”-elements.
That works fine, but now I want to add an Extraction Step that multiplies two of the extracted fields (“COUNT” and “PRICE”) and adds a new field “SUM” that is set to “39.90” and “100.00”, as if the XML did contain:
What you want to do is going to be done in the Designer. In the DataMapper, you are extracting the data, not creating new one. A simple script will multiply those two fields and replace a text value like @SUM@.
However, I’d like to compute that new value in the DataMapper and set it to the newly added field. All I need to do (as far as I understand) is to let the expression return the computed value. This should be simple, but one needs to access other values of the current element in the loop.
I tried your proposal - it works, but as those resulting valuesare required for SUBTOTAL- and SUBTOTAL-calculations, I’d prefer to calculate the value once, store it with the corresponding detail-record and simply use it later.
All of the POS-Tags will be read as “detail”-records to be used for a dynamic table; the SUM will be printed in every single line; the SUBTOTAL / TOTAL must sum up all SUM-fields.
I just want to keep the JavaScript in the dynamic table as simple as it can be.
If I can prepare the SUM-field for each POS-Tag in the DataMapper, I can use the built-in dynamic tables out of the box.
I already managed to calculate and set the value of other fields, but in this case I need to know how to refer to the fields PRICE and COUNT of the current “ROW” in the DataMapper.