Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

Why do my calculations not work? (Part 1)

In general, XpressDox handles calculations in an obvious way. For example, the fillpoint «FormatNumber(Amount * 1.1)» will show the Amount data element plus 10%. Or «FormatNumber(Amount1 + Amount2,'#')» will show the sum of Amount1 and Amount2.

But «FormatNumber(Amount1+AnotherAmount-Amount2)» will in all likelihood show ‘ “N” is not a valid digit’. The problem is that the minus sign (or, in XML a “Dash”) is a valid symbol in an element name, and so AnotherAmount-Amount2 is actually a data element name (and not AnotherAmount less Amount2), and will (probably) have no value, and so the XML processor will not know how to add its value to Amount1 and so will return “NaN” (Not a Number) for its value.

A good rule, then is to put a space around ALL the arithmetic operators (i.e. around + - * and div).

Note also that / is NOT the symbol for division: div is the symbol for division. Thus, to divide a number in half, the code would be:

The half-price sale value is $«FormatNumber(Price div 2)»

More information and examples of calculations are in the recipes Using variables , Performing calculations and also Why do my calculations not work? (Part 2)