Variables in Aliveforms

Variables are very useful in Aliveforms. There are system defined, user defined and response variables in Aliveforms.

What are variables?

Variables are basically dynamic values. A system defined variable can have input of screen, score of screen, server response variables have response from server stored in special variables etc. A user defined variable is defined by user using actionss in logic or script. It can store a number, string or list etc. A variable can also reference other variables.

The variable in Aliveforms is different from variables in JavaScript and PHP

How to define variable

A variable can be defined using actions of JavaScript API.

Using actions

Add Action Define variable, then enter name and value If it is string, quote it like "X" if it number type it like 10 or 15 if it is list, ["10", 1,12]

Using JavaScript API.

Use $.Var to define variable.

$.Var('X', 10)

Accessing variables in form

You can access system defined variables like [[SCEEN.0]] etc. User defined variables like [[VAR.VARIABLE_NAME]]. You can access list index like [[VAR.LIST.INDEX]]. Response variables are similar to user defined variables like [[VAR.RES:ID]].

How to store variable in other varible

You can reference other variables like [[REF.VARIABLE]] or you can use [[VAR.VARIABLE]]

What is difference between VAR and REF

REF is handled again after VAR

How to Evaluate Math?

Write Math Between [/ /]. Like [/ 10 * 10 /] [/ [[VAR.MULFACTOR]] * [[SCORE.1]] /] [/ [[VAR.MULFACTOR]] - 10 /]

System Defined Variables

Variable Use Example
SCORE Total weight (Analytical Form Only) Total Bill is [[SCORE]]
SCORE.INDEX Weight of screen (Analytical Form Only) [[SCORE.1]]
SCREEN.INDEX Input of Screen You selected [[SCREEN.2]]!
SCREEN.INDEX.JOIN Option texts of List or Options Screen, Joined with JOIN Chat Hi [[SCREEN.1.,]]!

If screen is Multiple Options, then it will display the options text

Response Variables

Variable Use Example
RES:RAWMESSAGE Raw/Original message returned by message.
RES:MESSAGE Message returned by server
RES:GROUPS Array of Groups names and values built after server logic units.
RES:MAXGROUP Name to dominant group from server logics. [[VAR.RES:MAXGROUP]]
RES:SCORE Total Score of quiz or total weight of weight based form. Your score is [[VAR.RES:SCORE]]
RES:ID Id of submission. Can be used for order tracking etc. Your order id is [[VAR.RES:ID]]
RES:INTEGRATION Output of integration. Requires the name to be provied. It is better to use with JavaScript Logic Unit Read Below

Displaying Integration Output via JavaScript

// Reading result output from Google Sheets Integration.
var res = $.Var('RES:INTEGRATION');
var result_str = `The average is ${res['Google_Sheets_Read'][0][1]}`;