Here’s a video on how to use conditional logic in Codeless:
To get a value from App Data, use the Get property of block. Here are a few tutorials on how to work with object’s properties (App Data is also an object):
to retrieve the value and now I can do the if-then-else to run different blocks of code.
What I am stuck on now is how to change the text in a text block and on buttons dynamically.
From my understanding, data bindings for components (text, buttons, etc) can be only done with Page Data, so I created logic to move the data into Page Data.
How then do I get that binding done? I have realised that if I hover over the “data binding property name” section, it is disabled - I assume this is since there are logic blocks associated to the component.
Keep in mind that data binding in UI components works with a data model that is “assigned” to a component.
There are two ways to execute data binding:
using a property name in the field right under “Content Logic”. In that case, when data is set to that property in the assigned data model (which is Page Data in your case), the content will be pulled automatically from the data model using the specified property.
or
using logic (as you tried). In that case, you need to retrieve data from wherever it is. In your case, the data is in the App Data model, so what you want to do is use the “return” connector and return the result of the “get property of” block. In fact, you already use it, simply move “get property of” to the “result” connector and it should work.
So, as I can see, using method 1 which uses App Data precludes me from doing the binding in the Content Logic Box (since it only works with Page Data). Once I move the data App to Page using logic, the Content Logic Box is disabled.
In method 2, I have done a print on the second page and verified that I am getting the data but how do I push that retrieved data into the text block and/or button labels?
Option 1
In the event when the page loads, get the value from App Data and assign a property in Page Data. Use the same property name for Content Logic data binding
Option 2
Keep the value in App Data and create logic for Content Logic where you will extract the value for button’s label from App Data (as I described in the previous response).
This is because you added logic for “Content Logic”. You can have either logic or property name in the field, but not both. If you want to be able to enter a property name, you need to click the red “trashbin” icon to delete the logic.