Creating functions
Prerequisites
Introduction
Functions are used to manipulate and fetch values in the form. They can be associated with rules and expressions applied to form fields, as well as with other functions.
Functions allow for rounding the values of a decimal field, changing the text inserted in a field from lowercase to uppercase, entering days in date fields, etc.
Since the case study is being carried out from a travel request form, to illustrate the use of the functions, we will create and apply a function so that the requester's name is automatically filled with the name of the user logged in to the system.
See how to create a function:
How to create a function
• For more details on rule creation, refer to the Configuring rules in the responsive form article.
• For more information on associating and filling out a form in process activities, refer to the Associating forms with process activities and Filling out forms when executing activities articles.
Options available for the Value source
Form field
Allows for using the value of a certain form field in the condition.
It is possible to verify if the field has been completed or compare the value of the field with another value, which may be a fixed value or the value of another form field.
After selecting the option, fill in the fields:
- Form field: select the form field that will be used in the condition. All form fields that can be completed will be available for selection.
- Operation: if part of the form field value needs to be refined or extracted in order to be used in the condition, select an operation. The operation options vary according to the value type of the form field.
Variable
Allows for using a table variable in the condition.
After selecting the option, fill in the fields:
- Value: select the variable that will be used in the condition. All variables created in the table will be available for selection.
- Operation: the operation options vary according to the value type of the form table variable.
Expression
Allows for using a form expression in the condition.
After selecting the option, fill in the fields:
- Value: select the expression that will be used in the condition. All expressions created in the form will be available for selection.
- Operation: the operation options vary according to the value type of the form expression.
Function
Allows for using a form function in the condition.
After selecting the option, fill in the fields:
- Value: select the function that will be used in the condition. All functions created in the form will be available for selection.
- Operation: the operation options vary according to the value type of the form function.
User data
Allows for using user data for the condition. User data comes from the workflow in which the form will be filled out.
After selecting the option, fill in the fields:
- Value: select which piece of user data will be used in the condition. The data available for selection is: user's ID, name, department, or position
- Operation: the system provides operations that allow for manipulating a value of the Text type originated from the user's data.
Process instance data
Allows for using instance data for the condition. Instance data originates from the workflow in which the form will be filled out.
After selecting the option, fill in the fields:
- Value: select which piece of instance data will be used in the condition. Instance, activity, requester user, requester customer, or instance starter data can be selected.
- Operation: the system provides operations that allow for manipulating a value of the Text type originated from the instance data.
Related-table data
Allows for using the data of the related table for the condition.
After selecting the option, fill in the fields:
- Table: select from which table the information will be fetched.
- Table field: select from which table field the information will be fetched.
- Operation: the system provides operations that allow for manipulating values originated from the table field.
Date
Allows for using the current date (today) in the condition.
After selecting the option, fill in the fields:
- Value: the condition can use today's date (dd/mm/yyyy).
- Operation: the system provides operations that allow for extracting a certain date value (dd/mm/yyyy). It is possible to extract the day (dd), the month (mm), or the year (yyyy) from the date, obtain the date's day of the week (as to the year), or obtain the week number corresponding to the date. It is also possible to add days, add hours, and consider only working days. Note that all values obtained with the operations will be values of the Integer type.
Time
Allows for using the current time in the condition.
After selecting the option, fill in the fields:
- Value: the condition can use the current time (hh:mm).
- Operation: the system provides operations that allow for extracting a certain time value (hh:mm). It is possible to extract the hours (hh) or the minutes (mm) from the time, convert the time to minutes, or convert the time to seconds. Note that all values obtained with the operations will be values of the Integer type.
Date and time
Allows for using the current date and time, in text format, in the condition.
After selecting the option, fill in the fields:
- Value: the condition can use the current date (dd/mm/yyyy) and time (hh:mm).
- Operation: the system provides operations that allow for extracting a certain value from the date (dd-mm-yyyy) and from the time (hh:mm). It is possible to extract the day (dd), the month (mm), or the year (yyyy) from the date, obtain the date's day of the week (as to the year), or obtain the week number corresponding to the date. It is also possible to extract the hours (hh) or the minutes (mm) from the time, convert hours to minutes, convert hours to seconds, add days, add hours, consider only working days, and convert the date and time values to text.
Geolocation
Allows for using geolocation data in the condition.
After selecting the option, fill in the fields:
- Value: the condition can use longitude (degrees) or latitude (degrees).
- Operation: the system provides operations that allow for storing values referring to latitude and longitude. These values can be stored in form fields and used in integrations with map APIs.
Risk
Allows for using risk data in the condition.
After selecting the option, fill in the fields:
- Value: the condition can use data originated from a risk plan, risk, control, opportunity, and risk and control evaluation.
- Operation: the system provides operations that allow for manipulating values of the Text, Integer, or Decimal type originated from risk data.
Operations
Operations available for selection
| Operation | Description | Fields |
| Uppercase | Select this option to use the field text in uppercase letters in the condition. | Text, Paragraph, Option group, and Simple list. |
| Lowercase | Select this option to use the field text in lowercase letters in the condition. | Text, Paragraph, Option group, and Simple list. |
| Remove spaces | Select this option to use the field text without spaces in between words, if any, in the condition. | Text, Paragraph, Option group, and Simple list. |
| Year | Select this option to use, in the condition, only the year (yyyy) of the date (dd/mm/yyyy) entered in the field. For example, if the value inserted is 31/12/2023, the condition will use value 2023. | Date |
| Month | Select this option to use, in the condition, only the month (mm) of the date (dd/mm/yyyy) entered in the field. For example, if the value inserted is 31/12/2023, the condition will use value 12. | Date |
| Day | Select this option to use, in the condition, only the day (dd) of the date (dd/mm/yyyy) entered in the field. For example, if the value inserted is 31/12/2023, the condition will use value 31. | Date |
| Weekday | Select this option to use, in the condition, the weekday of the date entered in the field. The days of the week will be returned as numbers for the condition, starting the count from Monday, that is, Monday is 1, Tuesday is 2, Wednesday is 3, Thursday is 4, Friday is 5, Saturday is 6, and Sunday is 7. | Date |
| Week number | Select this option to use the number of the week related to the year in the condition. For example, 40 indicates that the date is in the 40th week of the year. The week count starts on Monday, that is, the system considers a week as going from Monday to Sunday. | Date |
| Deny | Select this option if it is necessary to deny the value to use it in the condition. For example, if the value is checked (true), the condition will use the unchecked value (false). | Checkbox |
| Absolute | Select this option to use, in the condition, the absolute value of the number entered in the field. For example, if the value inserted is -10, the condition will use value 10, that is, |-10| = 10. | Decimal and Integer |
| Square root | Select this option to use, in the condition, the square root of the number entered in the field. For example, if the value inserted is 25, the condition will use value 5, that is, √25 = 5. | Decimal and Integer |
| Factorial | Select this option to use, in the condition, the factorial of the number entered in the field. For example, if the value inserted is 5, the condition will use value 120, that is, 5! = 5 * 4 * 3 * 2 * 1 = 120. | Decimal and Integer |
| Round up | Select this option to use, in the condition, the rounded-up integer value of the number entered in the field. For example, if the value inserted is 7.1, the condition will use value 8. | Decimal |
| Round down | Select this option to use, in the condition, the rounded-down integer value of the number entered in the field. For example, if the value inserted is 7.9, the condition will use value 7. | Decimal |
| Round | Select this option to use, in the condition, the rounded value of the number entered in the field. For example, if the value inserted is 7.4, the condition will use value 7; however, if the value inserted is 7.6, the condition will use value 8. | Decimal |
| Truncate | Select this option to use, in the condition, only the integer part of the number entered in the field. For example, if the value inserted is 42.22, the condition will use value 42. | Decimal |
| Hours | Select this option to use, in the condition, only the hours (hh) of the time (hh:mm) entered in the field. For example, if the value inserted is 15:26, the condition will use value 15. | Time |
| Minutes | Select this option to use, in the condition, only the minutes (mm) of the time (hh:mm) entered in the field. For example, if the value inserted is 15:26, the condition will use value 26. | Time |
| Convert to minutes | Select this option to use, in the condition, the value of the time entered in the field converted to minutes. | Time |
| Convert to seconds | Select this option to use, in the condition, the value of the time entered in the field converted to seconds. | Time |
| Automatic translation | Select this option to translate the text inserted in the field. | Text, Paragraph, Option group, and Simple list. |
| Working day | Select this option to use, in the condition, only the working days for date calculation. The system considers the configured calendar, disregarding weekends and holidays. | Date and Date and time. |
| Add days |
Select this option to add days to the date entered in the field. The calculation uses the system calendar and may consider only the working days, according to the applied configuration. The value source for the number of added days can be a fixed value or a variable configured in the form. |
Date and Date and time. |
| Add hours |
Select this option to add hours to the time entered in the field. The calculation follows the workday defined in the system calendar, allowing for precise time adjustments according to the configured office hours. The value source for the added hours can be a fixed value or a variable configured in the form. |
Date and Date and time. |
| Table field value | Select this option to use the table field value from the advanced list in the condition. | Advanced list. |
| Text |
Select this option to use the field value as text in the condition. This operation converts numeric or date and time data into formatted text, not respecting the decimal separator and the number of decimal places configured for the user language. In fields of the decimal or date and time type, the Text option is useful when the objective is to display the formatted value. For example, the system displays “0,02” instead of “0.02” or a readable date instead of the number corresponding to the timestamp. When the value will be used in calculations, it is recommended to maintain the operation as decimal, but when it is necessary to display the formatted value, the Text operation must be used. |
Decimal and Date and time. |
Conclusion
All done! Now you know how to create functions in the form. See how to configure expressions and rules in a responsive form.



