1. What Does This Page Cover?
Learn how to create a
variable to hold values that can be referenced and modified throughout your Creator application.
Learn more about
variables and its significance before moving ahead.
3. Creating Variables
A variable, once created, their values can be accessed and modified anywhere within your Creator application. This acts as a centralized approach to manage variables and their values to ensure consistency. Before creating a variable, make sure to understand all the relevant aspects of
variables.
Note: It is not recommended to store sensitive data in variables as they are accessible by admins, super admins, and developers. Additionally, the values stored in variables may become accessible to live application users through script execution. Unlike the data stored in forms,
user permissions cannot be configured for variables.
3.1. Variable Creation Flow
3.2. See How to Create a Variable
3.3. Steps to Create Variables
To create a variable:
- Go to the edit mode of your desired application to create variables and click Settings.
- Click Variables listed under Developer tools.
- Click the Add Variable button to create your first variable.
A pane will open on the right, in which you need to provide the details, such as Group Name, Variable name, and Value.
- Enter a name for your variable in the Variable field.
Note:
- You can create a maximum of 20 variables per application.
- The Variable name can contain alphanumeric characters, and underscore, but it cannot start with a number or underscore. Some examples of a valid variable names: interestRate, Branch24, email_id
- The Variable name must be less than 50 characters.
- Create a group to categorize your variables by clicking + Add Group and enter a group name. You can select a group from the dropdown if you've already created one. Alternatively, you can proceed without categorizing the variable in a group by leaving this field blank.
Note:
- You cannot have two variables with the same name within the same group.
- You can create a maximum of 10 groups per application, and the group names must be unique.
- The Group Name must be less than 50 Characters.
- The Group Name can contain alphanumeric characters, and underscore, but it cannot start with a number or underscore. Some examples of a valid group names: interestRate, ZykerBranch, organization_info
- Enter the value for your variable in the Defined Value field. The datatype of the variable will be auto-assigned based on the format of input value.
Note:
- The size of collection must be less than 2kB.
- You can only create up to four collections per application.
- Refer to the table below for sample values categorized by data type:
Data Type
| Sample Values
|
Number
| 1
Note: Only number values within the range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 are supported. |
Decimal
| 1.0
Note: The integral part of the decimal data type must not exceed 19 digits, and the fractional part cannot exceed 6 digits. |
Boolean
| true
|
Text
|
Hello World
Note: The maximum limit for TEXT type variable is 255 characters. |
Collection (List)
| ["Creator",6]
Note:
- DATE or DATE-TIME data type values are not supported inside a collection.
- Collection size cannot be more than 2 KB
|
Collection (Key-Value)
| {"Product" : "Creator", "Version" : 6}
Note:
- The key specified in the collection must be only TEXT.
- DATE or DATE-TIME data type values are not supported inside a collection.
- Collection size cannot be more than 2 KB |
Date
| '15-Aug-1947'
Refer this help document to learn about other supported date formats.
Note: Input date values can be in any supported date format. However, the format of the returned date value will be based on the application's date format settings. |
Note: If the value assigned to a variable does not match any of the specified data type formats, it will be considered as a TEXT data type.
- Click Create.
- Once added, you can view its defined value and current value as shown. You can use the search tab to search a variable with its name and filter tab to find the desired variable group.
Note: The defined value refers to the value assigned to the variable when it was created. On the other hand, the current value represents the real-time, last updated value of the variable after script executions within the application.
4. Create and Update Variables in Code View
Code View is a page that displays all the created variables in a formatted code format. This allows you to easily access and manage the variables created for that application.
Note: You cannot rename or delete a variable or variable group in the code view
To create a variable in code view:
- Navigate to Variables under Developer Tools in your application settings. All variables that you have created will be listed here.
- Click Code View in the top-right corner, as shown.
- You will be shown the created variable in the code format. If you haven't created any variables previously, you will be presented with an empty Deluge editor.
- You can edit the values in the code directly or create a new variable by following the syntax given below.
Creating a variable with group:
- thisapp.variables.<group_name>.<variable_name> = <value>;
Creating a variable without group:
- thisapp.variables.<variable_name> = <value>;
Click Save. A pop-up will be shown with the change summary to confirm the changes to be made.
Click Proceed in the pop up to save the changes made in the Code View.
5. Access and Modify Variables Using Deluge
Variables within the applications can be both accessed and modified using Deluge. Any modifications made to a variable's value through the Deluge script will be stored as the variable's current value. This current value dynamically updates in real-time to reflect the most recent modification triggered by script executions within the application, and this updated value propagates throughout the entire application.
Note:
- Simultaneous modifications and access to a variable may not give expected results.
- The value of a variable updated through a Deluge script will be reflected in the current value only at the end of the script execution, even though the script executes using the modified value.
To access and utilize variables in your application, follow the syntax below:
For variables inside a group,
- //To access a variable
- thisapp.variables.<group_name>.<variable_name>;
- //To modify a variable
- thisapp.variables.<group_name>.<variable_name> = <value>;
For variables without group,
- //To access a variable
- thisapp.variables.<variable_name>;
- //To modify a variable
- thisapp.variables.<variable_name> = <value>;
Where:
- <group_name> is the TEXT that represents the name of the group to which the variable belongs.
- <variable_name> is the TEXT that represents the name of the variable in the specified group to access its value.
Example
Suppose you have a variable named Organization_Name with a a value Zylker Technologies within a group named Organization_Details, you can access its value using the script as follows:
- info thisapp.variables.Organization_Details.Organization_Name; // Returns Zylker Technologies
6. Variables in Different Environments
Variables can be
created and
managed only from the application settings in the development environment of the application. However, when the application is published from the development environment to subsequent environments, the current values of variables will not be carried forward. Instead, they will be replaced with their published defined values. The current values may differ in each environment depending on the script executions specific to the environment.
Note: In the environment settings, you can only view the defined value and current value of variables specific to that environment. To
create or
manage variables, you must access the application settings in the development environment.
Example:
Consider a variable named 'Interest' with a defined value of '7.5' and a current value of '8.0' in the development environment. When the application is published to the stage environment, only the defined value of the variable is carried forward, and the current value by default is set as the defined value of '7.5'. Now, both the defined and current values of the 'Interest' variable will be '7.5' in the stage environment. The following table depicts the same for better understanding:
Variable | Development Environment | Stage Environment |
Interest | Defined Value | Current Value | Defined Value | Current Value |
7.5 | 8.0 | 7.5 | 7.5
|
The same scenario applies to publishing the variable from the stage environment to the production environment
To view environment-specific variables and their values, navigate to the Variables section in the environment settings.
Learn More7. Manage Variables
Managing variables offers the following operations :
- View variable reference
- Edit variable
- Delete variable
- Rename group
- Delete group
7.1. View Variable References
References contain a list of all the places within your application where the specific variable is being used. To view references:
- Navigate to Variables under Developer Tools in your application settings. All variables that you have created will be listed here.
- Click on the desired variable name you'd like to see references for.
Click on the View Variable Reference hyperlink below the Variable field.
You will be shown the pop-up with the list of all places where the variables is used in your application.
7.2. Edit Variable
Editing the variable value will automatically update both the defined value and the current value. To edit the variable:
- Navigate to Variables under Developer Tools in your application settings. All variables that you have created will be listed here.
- Click on the variable name that you want to edit.
- On the next page, you will be shown the details of the variable. Click on the Variable field to modify the variable name and the Value field to update the variable's value.
Note:
- A variable cannot be moved from one group to another.
- You cannot assign a value with a different data type to the variable. In other words, the data type of the variable cannot be modified.
- Click Update.
- The changes will be saved immediately once you click Change in the confirmation popup that appears.
- For collection variable type modifications, such as changing from a list to a key-value structure or vice versa, a pop-up window will appear, displaying references to all the locations where the collection variable is used. You can review these references and click Change to save the changes.
Note: When removing a key from a key-value collection, replace the references with appropriate values. Similarly, when adding a key to a list-type collection, make sure to replace the references with key-value pairs. This precautionary step is essential to prevent potential errors in your application and maintain its functionality.
7.3. Delete Variable
To delete a variable:
- Navigate to Variables under Developer Tools in your application settings. All variables that you have created will be listed here.
- Hover over the variable that you want to delete and click the delete icon () that appears.
- If the variable is not used in your application, it will be deleted immediately once you click Delete in the confirmation popup that appears.
- Otherwise, a popup with references of all the places where you have used the variable will be displayed.
- You need to delete all the mentioned references in order to Proceed to Delete the variable.
7.4. Rename Group
When you rename a group, the new group name will be applied to the variables and their references within the group throughout the application. To rename a variable group:
- Navigate to Variables under Developer Tools in your application settings. All variables that you have created will be listed here.
- Hover over the desired group name that you want to change and click the edit icon ().
- Enter the new group name in the pop-up and click Rename.
7.5. Delete Group
To delete a variable group:
- Navigate to Variables under Developer Tools in your application settings. All variables that you have created will be listed here.
Hover over the desired group name that you want to delete and click the delete icon (
).
If the variables in that group is not used in your application, it will be deleted immediately once you click Delete in the confirmation popup that appears.
Otherwise, a popup with the list of all variables with references will be displayed.
You need to delete all the mentioned variables and its references individually in order to Proceed to Delete the variable group.
8. Points to Note
- Variable names within a group must be unique.
- The data type of the variable remains constant once it is created and it cannot be changed. For the collection data type, the value can be changed from list to key-value format and vice versa.
- When changing the key-value type collection into a list-type collection, replace the references with appropriate values. Similarly, when changing a list-type collection to key-value type collection, make sure to replace the references with key-value pairs. This precautionary step is essential to prevent potential errors in your application and maintain its functionality.
9. Limitations
- It is not possible to create a sandbox with C5 application, if it contains variables.
- Variables are not available for applications within the C5 sandbox and developer zone.
- A maximum of 10 groups can be created per application.
- A maximum of 20 variables can be created per application, irrespective of the number of groups. Among the 20 variables, only a maximum of four variables can be of the collection data type.
- The size of each collection variable must not exceed 2 KB.
- A variable cannot be moved from one group to another.
- System variables can be only assigned to a variable through a Deluge script.
- Renaming or deleting a variable or variable group is currently not supported in code view.
- A maximum of 500 variable assignments can be performed via a Deluge script per day.
- Simultaneous modifications and access to a variable through scripts may not give expected results.
- Value of variables cannot be modified through scripts in the following workflow actions:
- Form on load
- Form on validate
- User input of a field
- Subform - Addition of row
- Subform - Deletion of row
- Subform - User input of a field
- Stateless form - button actions
- Page script
Note: If a function involving variable modification is invoked within these actions, it will not be executed.
- Understand Variables