Search code examples
itext

iText DITO - How can I use a fields Data name as a reference in a calculation?


In iText's DITO template designer product, I have one field which has a fairly complex calculation. In another field, I want to use the result of that calculation.

The tooltip says "Identifier used for referencing fields in calculation expressions". So I assumed if I named it blah I can use it in a calculation in another field like this: sum({{blah}},42) (e.g. add 42 to the value of blah). But if I do that I get the error

Unable to resolve reference: "{{blah}}" in node with tag: <span> and text:

itext-dito-properties

The iText DITO documentation does not elaborate on this feature at all. I'm evaluating iText DITO and there does not seem to be any way to get support while evaluating the product.


Solution

  • Suppose I have a field with a very complex calculation. In order to reuse the calculation result, I can do the following:

    1. Give a name to this field (in the image below I've chosen name "total") enter image description here
    2. Insert a calculation to another field (where I want to reuse "total") enter image description here
    3. Add "total" as the calculation's body: List item

    That's it, now the total value is reused: enter image description here