Custom Variable

The Goal

Add and set up Custom Variable and check its setting in the Data Explorer.

The Description

The State Variable is part of a current View where its setting is immediately reflected in the Data Explorer and its plays important role in storing temporary data within a current View.

Keep in mind that State Variables are not addressable between another Views.

The Knowledge You Will Get

  1. Addressing and Editing of a State Variable.

The Project Structure

1. Create a State Variable

  1. Clicking on the Add Datasource icon select Add State Variable.

  2. Name its ID -> myVariable and switch its Type to Number; Initial Value -> 6

You can watch the myVariable attributes and functions in the tab from this moment.

2. Associating myVariable Value

  1. Consider that we are not going to play with Layout; simply place in the Canvas work field a new Text component and set up its Value as follows:

  2. Value -> myVariable.value

The Current Value of the myVariable can be dynamically mapped by a (ƒx) function.

The Conclusion

Using the State Variable can be effectively used in many cases. Try to change State Variable Types to Array or Map, and define their Values as a constant or function.

Follow up on our Custom Variable tutorial

Last updated