Data from Action
Last updated
Last updated
Prepare a Basic Application returning data from action and its content display in the Canvas.
Let's say that we will prepare an action returning Hello World
String which will be displayed in the middle of the Canvas by the Text component.
Working with data returned by action and its association with a component.
Hello World
StringThe action itself is not executed till we call it by some Method or schedule it. Let's prepare an Action returning Hello World
String and test its output.
Create an Action and name it GetHelloWorldText
.
On Start: Place in the Output Function, wire it together, and set up its Option -> Value –> "Hello World
"
Save & Run Action in the Tester and check if the Return Value is output: "Hello World"
Binding together GetHelloWorldText
Action and Add Data from Action will provide an associable data source in the current MainView
.
Create a new Add Data from Action in the Outline Panel and name it myData
.
In the Inspector set up Action Name -> GetHelloWorldText
by click & select.
Check myData
structure in the Data Explorer. If you did it right, you can see myData
-> output: "Hello World"
.
Showing data content can be done by the Text component, as in our case here.
Place into the Canvas a new Container and set up its Item Flex -> Stretch
; Vertical Alignment -> Middle
Into the Container put a Text component with the following configuration: Text Alignment -> Center
; Text Style -> Bold
; Font Size -> XXXLarge
; Foreground -> RED
Finally, associate data returned by Action: Value -> myData.data
We learned that Actions can provide returning values that have to be bound by adding data sources in the required View. Try to add more returning values and associate them with different Components.
Follow up on our Data from Action tutorial https://youtu.be/zdR6fGLgbDo