The Encodian population engine enables certain maths functions to be used and therefore enables you add this logic into your template document. This logic can be used for both whole and decimal numbers.
Example Documentation: Encodian - Template Syntax - Mathematics
Example JSON data:
{
"ProductAAmount": 5.0,
"ProductBAmount": 3.0
}
Configure the document with the required logic:
Addition (A+B) :
<<[ProductAAmount + ProductBAmount]>>
Subtraction (A – B):
<<[ProductAAmount - ProductBAmount]>>
Multiplication (A * B):
<<[ProductAAmount * ProductBAmount]>>
Division (A/B) :
<<[ProductAAmount / ProductBAmount]>>
This generates the following output:
- In order for whole number division to work correctly you must have the trailing 0’s in the JSON and also set the 'JSON parse mode' to strict within the Encodian actionIf you do not it will drop all values after the decimal place and just return the whole number (not rounded)
If you are only adding/subtracting/multiplying whole numbers you can leave off the trailing 0’s from the JSON.
0 Comments