About this article
This article will explain what functions, conditions, and operators are in Templafy, where they can be used in smart templates, and which ones can be utilized with the binding syntax.
- What are functions, conditions, and operators?
- Which functions, conditions, and operators can be utilized in the binding syntax?
- Where can functions, conditions, and operators be used in smart templates?
Prerequisites
|
What are functions, conditions, and operators?
Functions, conditions, and operators can be utilized together with the binding syntax to achieve more complex use cases than the default behavior provided by the smart fields. When inserting a smart field, it might be necessary to adjust the default binding to achieve the intended result.
Function example: In the smart document, the user should pick a date in the response form. Based on the date input from the response form, two different smart fields should be populated in the template:
- One should be the date that was chosen by the user
- The other one should be 30 days after the date chosen by the user
This is achievable by using the DateAdd() function together with the binding syntax of the date response form: {{DateAdd(Form.Date, 30, "d")}}
There are many more use cases that can be solved based on the functions listed below.
Condition and operator example: In the smart template, the user should choose the classification (public, internal, or confidential) in the response form:
- If the chosen classification is confidential or internal, the disclaimer should be visible in the template
- If the chosen classification is public, the disclaimer should not be visible in the template.
This can be achieved using the IfElse() condition with the Equals() operator in the binding syntax of the classification response form: {{IfElse(Equals(Form.Classification.Name, "public"), VisibilityType.Hidden, VisibilityType.Visible)}}
Additional conditions and operators such as Not() and Contains() can also be utilized.
Which functions, conditions, and operators can be utilized in the binding syntax?
There are different types of functions, conditions, and operators that can be used in smart templates, below is a comprehensive list of the available functions linked to deep-dive articles.
General functions
- How to get the value from a specific column and row within a data source using DataSource[]?
- How to get the value from a specific column and row within an external data source using ExternalDataSource[]?
- How to compare one value to multiple values and return results accordingly using Switch()?
- How to translate terms using Translate()?
Date functions
- How to format date and time using FormatDateTime()?
- How to display the current date using Now()?
- How to add days, weeks, months, quarters, or years to a selected date using DateAdd()?
- How to subtract days, weeks, months, quarters, or years from a selected date using DateSubtract()?
- How to transform a date and time in text format into a date object using DateValue()?
Text functions
- How join multiple pieces of text with a separator using StringJoin()?
- How to join two pieces of text together using Concat()?
- How to convert text to upper case using Upper()?
- How to convert text to lower case using Lower ()?
- How to convert text to proper case using Proper()?
- How to convert text to sentence case using SentenceCase()?
Numerical functions
Conditions and operators
- How to provide an output based on a condition using IfElse()?
- How to reverse the value of a True/False using Not()?
- How to determine if two values are equal using Equals()?
- How to determine if the source text contains a specific search value using Contains()?
Where can functions, conditions, and operators be used in smart templates?
Functions, conditions, and operators are usually utilized in the Template
tab with the smart fields, or in the Advanced
tab with the template settings and properties.
Smart field examples
![]() |
Adjusting the user name originating from the user information smart field to be converted to uppercase Binding used: |
![]() |
Adjusting the visibility of the group smart field based on the introduction checkbox question originating from the response form:
Binding used: |
![]() |
Translating the word Subject based on the Document language dropdown question originating from the response form. (Requires the Translations data source to be populated) Binding used: |
Document settings and properties example
![]() |
Using the Title question originating from the response form and the user name originating from the user information smart field separated with a "_" as a Document name in the template properties Binding used: |
Related articles
Comments
0 comments
Article is closed for comments.