XactCommerce Xact Objects
Home
News
XactCommerce
Typical Applications
Custom Development
Private Backend
XactScript Language
Performance
Deployment
Partners
Portfolio
About Us
leXml Language < Interface Modules & Commands < If_Math

If_Math
The Math Expression Interface module provides tools for evaluating math expressions

evaluate
This command evaluates an expression. The 'expr' argument is the expression to be evaluated and all other arguments are numeric variables that can be used in the expression. This returns the result or 'error:...' if some error occurs.
 
Expressions can contain the operators ^, *, /, +, and - as well as parentheses. Anything that's not a number is considred a variable. Nonexistant variables are counted as 0.
 
Example:
expr=(counter+1)*2
counter=$counter
 
This would return, for instance, 4 if counter==1.


trimdecimal
This returns a trimmed decimal
 
Arguments:
value=untrimmed decimal value as String or Number


moneyshow
This returns a number string suitable for showing as money
 
Arguments:
value=any numeric value as String or Number


round
Returns a rounded decimal value to nearest integer


randomint
Returns a random integer


randomdecimal
Returns a random decimal between 0.0 and 1.0