Variables are nothing but containers for data. The value of a variable changes during the execution of a script and hence the name 'variable'. Variables can be given value, and values once given can be altered any number of times. The Deluge Set Variable task is used to set a value to a variable. Variables in deluge are strongly typed , in the sense, variables defined to hold number will hold only numbers till the script termination and variables defined to hold string will hold only string values till the end of script execution. 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.
variable = value;
- 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.
- Lets say we have a form with a date field named date_field. To set the value of date_field with the current date, when the form loads, add the following script in On Load workflow section:
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, add the following script in the On Validate workflow sectioninput.PatientID = input.First_Name + " " + input.Last_Name + " " + zoho.currenttime;