Overview
In simple terms, a variable is an identifier that stores known/unknown data also referred as value. The value of a variable is subject to change during execution of script, hence the name 'variable'. Variables can hold only specified datatypes, in the sense, variables defined to hold number will hold only numbers and variables defined to hold string will hold only string values till the end of script execution. The Deluge Set <Variable> is used in form action and field action scripts, to assign a value to a variable.The two types of variables used in deluge scripting are :
- Form fields are the variables that get declared automatically and these variables can be used in scripting.
- Variables defined by the user, in the action scripts.
Syntax
where,
- variable is any user-defined variable or input form fields.
- value - the value assigned to the variable. The value can be any of the following:
- value specified in input form fields
- value held by user defined variables.
- value returned by zoho variables.
- numeric / string /date value. The string value must be enclosed in double quotes and date value must be enclosed in single quotes.
Example
- To set the value of a field. Lets say we have a form with a date field with deluge name as Date_field. To set its value as the current date:
- Go to the Workflow editor of the form.
- Click on Free-Flow scripting on the top right corner.
- Under Form Actions, select On Add > On Load and and add the following script:
Date_field = zoho.currentdate;

- To set the value of a field, based on values specified for the other fields.
Lets say, we have a form with fields PatientID, First_Name and Last_Name. The value of the field PatientID needs to be set based on the field values of First_Name, Last_Name and the value returned by the system variable zoho.currenttime. To achieve this,
- Go to the Workflow editor of the form.
- Click on Free-Flow scripting on the top right corner.
- Under Form Actions, select On Add > On Validate and add the following script:
input.PatientID = input.First_Name + " " + input.Last_Name + " " + zoho.currenttime;