Tag Formulas
Sometimes you might need to calculate values within your document template. Within Portant you can add calculations directly within tags simply by include = at the beginning of the tag.
For example you may have the field "Line Item Price" within your workflow and you would like to include the value with a 10% percent tax. This can be calculated by multiplying (*
) the Line Item Price by 1.1. The Tag formula to do so would look like this.
Arithmetic
The follow arithmetic operations can can be used in Tag Formulas:
Symbol | Operation |
---|---|
+ | Addition |
* | Multiplication |
- | Subtraction |
/ | Division |
Multiple operators and parentheses: (
and )
can be used to make more complex expressions.
Builtin Formulas
Similar to tools like Google Sheets and Excel. Certain pre-made formulas can be used within tags. For example the ROUND
formula can be used to limit a numeric value to set number of decimal places.
The following builtin formulas exist within Portant
Formula | Description |
---|---|
| Rounds the numeric value of |
DEFAULT(Tag, Default Value) | Provide a value to be used in the case that the value of the provided tag is blank. |
| Adds the numeric value of two or more tags together. This formula is the same as simply using "+". |
| Multiplies the numeric value of two or more tags together. This formula is the same as simply using "*". |
| Shortens the text based value of |
Note, direct values can be used in the place of all tags and vice versa.
Aggregated Formulas
Particular builtin formulas are specifically designed to work with Data Grouping workflows in Portant and will aggregate all the grouped values of the specified tag. A particular useful formula is SUM
which will add together all values for the specified tag. This is an effective way to calculate totals within your template.
The follow aggregated formulas exits within Portant:
Formula | Description |
---|---|
| Adds together all the values for |
| Multiplies together all the values for |
| Calculated the average of all values for |
| Finds the largest of all values for |
| Finds the smallest of all values for |
Aggregated formulas can also be used anywhere within the document to make more complex formulas. For example you could calculate the percentage a certain Line Item Price is of the total.
For the line items in the table example above this would create the following result:
Decimal Place Modifier
By including the symbol |
followed by the number of decimal places you would like to limit the result to an expression can be rounded similar to the ROUND formula itself.
For example we can round the following arbitrary expression to 3 decimal places like so:
Formula Glossary
Sum
Returns the sum of a series of field values, including all field values within a Data Group tag
{{=SUM(tag name, tag name)}}
Syntax
{{=SUM(tag1
, tag2
, ...)}}
tag1
- The first tag to add together.tag2
, ... - [ OPTIONAL ] - Additional tags to add to tag1.
The tags included in the brackets don't need to be accompanied by "{{" and "}}"
Average
The AVERAGE function returns the numerical average value in a group of tags, including all field values within a Data Group tag
{{=AVG(tag name, tag name)}}
Syntax
{{=AVG(tag1
, tag2
, ...)}}
tag1
- The first tag or Data Group tag to consider when calculating the average value.tag2
, ... - [ OPTIONAL ] - Additional tags to consider when calculating the average value.
The tags included in the brackets don't need to be accompanied by "{{" and "}}"
Maximum
Returns the Maximum value from a group of tags, including all field values within a Data Group tag
{{=MAX(tag name, tag name)}}
Syntax
{{=MAX(tag1
, tag2
, ...)}}
tag1
- The first tag or Data Group tag to consider when calculating the maximum value.tag2
, ... - [ OPTIONAL ] - Additional tags to consider when calculating the maximum value.
The tags included in the brackets don't need to be accompanied by "{{" and "}}"
Minimum
To find the Minimum value from a group of tags, including all field values within a Data Group tag
{{=MIN(tag name, tag name)}}
Syntax
{{=MIN(tag1
, tag2
, ...)}}
tag1
- The first tag or Data Group tag to consider when calculating the minimum value.tag2
, ... - [ OPTIONAL ] - Additional tags to consider when calculating the minimum value.
The tags included in the brackets don't need to be accompanied by "{{" and "}}"
Round
The ROUND function rounds a tag to a certain number of decimal places according to standard rules.
Sample usage {{=ROUND(tag name, 5)}}
{{=ROUND(tag name, tag name 2)}}
Syntax
{{=ROUND(tag
, [places
])}}
Tag
- The value to round toplaces
number of places.places
- [ OPTIONAL -0
by default ] - The number of decimal places to which to round.
Multiply
Returns the product of two tags or a tag and a number. Equivalent to the `*` operator.
{{=MULTIPLY(tag name, tag name)}}
{{=MULTIPLY(tag name,0.5)}}
Syntax
{{=MULTIPLY(tag1
, tag2
)}}
tag1
- The first multiplicand.tag2
- The second multiplicand.
The tags included in the brackets don't need to be accompanied by "{{" and "}}"
Add
Returns the sum of two tags. Equivalent to the '+' operator. In Data Grouped tags the calculation occurs per row of data, NOT for all data within the group.
{{=ADD(tag name, tag name)}} {{=ADD(tag name, 5)}}
Syntax
{{=ADD(tag1
, tag2
)}}
tag1
- The first addend.tag2
- The second addend.
The tags included in the brackets don't need to be accompanied by "{{" and "}}"
Truncate
Shortens the value of a tag by the specified length.
Syntax
{{=TRUNCATE(tag, length)}}
tag
- The text to be truncated.length
- The number of characters to to limit the text to.
If length is greater than the number of characters in value, value is returned without modification.
Example
{{Message}} -> "Hello World" {{=TRUNCATE(Message, 5)}} -> "Hello"
Feedback and feature suggestions
We created Portant in 2021 and the feedback we have received since then has been very helpful and greatly appreciated. If you have any feedback, please feel free to send us an email at contact@portant.co or use our contact form here: https://www.portant.co/support
Thanks,
Blake and James
Last updated