Variables

Description

Variables are nothing but container 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> 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.

Syntax

<variable name> = <value>;

where,

  • Variable name - Variable name must start with a-z or A-Z and it can contain numbers and underscore "_" , but spaces are not allowed in variables.
  • Assignment operator - Followed by variable name is an assignment operator '=' which assigns the value to given variables.
  • Variable value - the value assigned to the variable. Value can either be a constant or an expression, for example,
    • 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

  1. To set the value of the date field with the current date, when form is loaded.

    //zoho.currentdate is the zoho variable which returns the current date
    date1 = zoho.currentdate;

  2. To set the value of a field, based on values specified for the other fields

    In the following deluge code, the value of the field PatientID is calculated based on the form values specified for the First_Name and Last_Name and the value returned by the zoho variable zoho.currenttime.

    input.PatientID = input.First_Name + " " + input.Last_Name + " " + zoho.currenttime;

    Related Links

Share this post : FacebookTwitter