The following is a list of Jinja2 math, comparisons, and logic operators that can be used in Oomnitza.
Math operators
Decimal and numeric fields
The following set of math operators can be used to perform calculations on decimal and numeric fields. You can use the following operation to add values:
{{currency + 42}}
{{42 + currency }}
or subtract values:
{{currency - 42}}
{{42 - currency }
The following is a list of other supported math operators for use on decimal and numeric fields:{{currency * 2}}
{{currency ** 2}}
{{2 * currency }}
{{currency / 2}}
{{100 / currency }}
{{currency + currency }}
{{currency + currency + currency }}
Date fields
The following set of supported math operators can be used to perform calculations on date fields. For example, you may want to calculate the age of a password or a security token in days:
{{purchase_date + 42}}
{{purchase_date + 40 + 2}}
{{42 + purchase_date}}
{{purchase_date - 42}}
{{42 - purchase_date}}
or calculate the difference in days between 2 dates:
{{(change_date + purchase_date).days}}
{{(change_date - purchase_date).seconds}}
String fields
Finally, the following set of math operators can be used on string fields.
{{barcode + 42}}
{{barcode - 42}}
{{barcode * 3}}
{{barcode / 3}}
{{barcode + barcode}}
Comparisons
String fields
The following set of sting operators enables you to compare string fields. For example, the following string operation can be used to check the contents of two text fields, and determine if they are the same:
{{barcode == 'LX004322'}}
or determine if they are different:
{{barcode != 'LX004322'}}
The following is a list of other supported string comparisons you can use to compare string fields:
{{barcode > '123'}}
{{barcode < '1234567890'}}
{{barcode >= 'LX004322'}}
{{barcode <= 'LX004322'}}
Result
Returns True or False.
Tip
For further information, refer to the Python Documentation: String methods.
Date fields
The following set of logic operators enable you to perform comparisons on date fields.
{{purchase_date == '09/03/2019'}}
{{purchase_date != '09/03/2019'}}
{{purchase_date > '09/03/2000'}}
{{purchase_date < '09/03/2222'}}
{{purchase_date >= '09/03/2019'}}
{{purchase_date <= '09/03/2019'}}
{{purchase_date == purchase_date}}
{{purchase_date == change_date}}
{{purchase_date != change_date}}
{{purchase_date > change_date}}
{{purchase_date < change_date}}
Result
Returns True or False.
Logic
Decimal and numeric fields
The following set of logic operators enables you to perform comparisons on decimal and numeric fields. For example, the following operators can be used to compare decimal or numeric values and determine if they are the same:
{{currency == 7.7}}
{{7.7 == currency }}
or determine if they are different:
{{currency != 7.7}}
{{7.7 != currency }}
The following is a list of other supported math comparisons you can use on decimal or numeric fields:
{{currency < 100}}
{{100 > currency }}
{{currency > 100}}
{{100 < currency }}
{{currency >= 7.7}}
{{7.7 <= currency }}
{{currency <= 100}}
{{100 >= currency}}
Result
Returns True or False.
Documentation
Jinja:Template Designer Documentation
Python Documentation(for supported string methods)
Comments
0 comments
Please sign in to leave a comment.