This document describes how to declare and use variables in a block-coded manner.
Index
Definition and Function of Variable
•
A variable is a space (memory) with a name (variable name) that stores a specific value.
•
A variable stores a variety of values
Types of Variable Blocks
1) Create + Set to
•
2) Create
•
Use to declare a variable.
•
Variable names are declared as string and integer types.
3) Set to
•
It is usually used together with the Create block and is used to set the value of a declared variable.
•
Enter the variable name to set the value in the Primitive block next to Set.
•
Enter the value to set next to to as a block. Various values such as data types or data structures (HashMap, Array)can be put.
4) Get
•
Get the value of a declared variable
•
Invalid variable name calls will result in 'Not found data' exception.
•
Here are examples of Create, Set to, and Get
No. | Function |
1 | Declare(Create) the variable 'HelloMessage' and enter (set to'HelloSyncTree' as a value. |
2 | Create + Set to block declares the variable 'ResponseMessage' (create), gets the value of the variable 'HelloMessage' (get), and registers it as the value of the variable (set to). |
3 | Check the test results that match the values of the two variables |
5) Create Set - Async Argument
•
It is used to assign global variables of BizUnit to the argument values of the Async block.
•
6) Fetch
•
Get and control the header and body data of a specific Transfer blockset
•
The value of the Fetch enters the ID of the transfer blockset to call.
•
An example of bringing the request data to a fetch and showing it in a Json type.
No. | Function |
1 | Enter the Transfer ID of the Request blockset into the Fetch block and place it in a variable called FetchData. |
2 | Adds a value to Request Data in the Bizunit Test. |
3 | Run to verify that Request Data has been received through the Fetch block |
Reserved word __origin__
•
The Fetch block uses the reserved word ‘__origin__’ to parse the entire Request header of the BizUnit.
•
Below is the same code as the above example, but showing different results through the reserved word ‘__origin__’ .