Use Variables & Expressions
Variables are placeholders used to hold and maintain certain values. In some cases, it is possible to not know some of the values that you might want to display or use within the Application. In this case, you can use Variables where the real value can be substituted in later. Expressions can also be configured and are useful for doing certain calculations and returning results which can also be used in the Application.
To add a Variable to the Application, follow the steps below:
- 1.Open the editor for the Application.
2. Open the page the Variable will be stored in. 3. Click on Page Data. 4. Click on the plus symbol to add a new Variable.
5. Type the name of the Variable. 6. Enter the type and whether it is a value or expression. 7. Click on Save.
The Variable should show in the list of Variables.
To use a Variable, follow the steps below:
- 1.Highlight the Block you want to bind the Variable to. In this case, it is a textbox for the user’s input.
- 2.Click on Block Properties.
- 3.Expand Value.
- 4.Select the Variable
- 5.Click on Save.
When adding a Variable, there is an option to build an expression. The example below shows an expression that multiplies the values of two variables together. To build an expression, follow the steps below:
- 1.Change the mode to expression.
- 2.Select the expression box.
- 3.Select from a range of parameters, Variables, and other functions to build an expression. When a value is selected it will appear in the expression box.
Numbers are identified as integers by default. Convert to other data types using:
- a method e.g.
ToLong(0)for the value 0 as a long
2.0for the value 2 as a double
4. Click on Save.
To delete a Variable, follow the steps below:
- 1.Click on Page Data.
- 2.Click on Edit to edit the Variable.
- 3.Click on Delete.
4. Confirm that you want to delete the Variable.