Understand that you need to make some kind of comparison in order for a Constraint to work, which you are not currently doing. Since the Mod
operator will return the REMAINDER of a division, your Constraint could be this…
[=TN('{TICKET QUANTITY SUM:White Wine}') % 2] == 0
or depending on what you’re going for, inversely, this:
[=TN('{TICKET QUANTITY SUM:White Wine}') % 2] != 0
EDIT: a safer comparison might be to not use the Mod operator (%
) at all, and instead use the Integer Division operator (\
), and compare it against the Regular Division operator (/
):
[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] == [=TN('{TICKET QUANTITY SUM:White Wine}') \ 2]
Inversely:
[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] != [=TN('{TICKET QUANTITY SUM:White Wine}') \ 2]
EDIT2: you can disregard the notion of using the Integer Division operator (\
) since it does not seem to be available - it does not produce a result.
@emre, I remember you mentioning that you might be switching to a different Scripting Engine with expanded function support in some regard. Are there other functions we could use, like casting values, for example [=int(x/y)]
, or using something like Floor()
?
EDIT3: this should do the trick:
[=FF('{TICKET TOTAL}','#')]
… Strips decimal parts from numbers.
In your case:
[=FF((TN('{TICKET QUANTITY SUM:White Wine}')/2),'#')]
So you could compare decimal division to “integer” division like this:
[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] == [=FF((TN('{TICKET QUANTITY SUM:White Wine}') / 2),'#')]
Inversely:
[=TN('{TICKET QUANTITY SUM:White Wine}') / 2] != [=FF((TN('{TICKET QUANTITY SUM:White Wine}') / 2),'#')]
The message below shows:
Quantity (Q): 5
Divide Decimal (Quantity/2) (D): 2.5
FF(Q/2,'#') (I): 3
Q:[=TN('{TICKET QUANTITY SUM:Cookie Signature}')] D:[=TN('{TICKET QUANTITY SUM:Cookie Signature}')/2] I:[=FF((TN('{TICKET QUANTITY SUM:Cookie Signature}')/2),'#')]