Do you love checklists, but hate having to create variables for every single checkbox on every single page? On some of my bigger apps I would end up with literally hundreds of Boolean variables cluttering up the app and requiring a ton of manual data entry and error prone variable updating. These three ‘On Step Enter’ triggers saved in the base layout of the app can eliminate all of them
First, save the previous step’s values to a text list array with the step name
Note: I’m saving the ‘False’ states so this works with the pass/fail custom widget https://tulip.co/library/apps/pass—fail-checkbox-widget/
Second, restore the current step’s variables and remove them from the array if they exist
Finally, save the current step’s name so it’s ready to use when you go to the next step
Copy parts one and two for each of the variables you want to reuse. Note that this trick has issues with steps that have identical names. The same trick should work for other types of variables, but I haven’t found a reason to do so yet
@Gary thanks so much for sharing this! Love the tip. And the “infomercial” style introduction too
Great post! Thank you for sharing!
I for myself have more of an issue with more trigger logic, than with more well named variables.
However, for your approach keep in mind:
- You did not handle the case where the boolean is null
- You only reset the value in the array, when you read the value. So you could potentially write two or more values for the same variable. This could happen, if a transition fails or the App is not built waterproof for that kind of variable handling.
- You may get confused, if you need some variables on both steps and some not.
Additionally I’m a bit confused, that you store your variable with “Previous Step” … shouldn’t it be the Current step for storing?
Here is an approach for a solution without using the If conditions.
It keeps null values in mind and it will only allow one value per variable-step-combination…
@thorsten.langner great points! I should have used an ‘On Step exit’ trigger to save the variables instead of in the next step’s ‘on step enter’. I like the use of LINK and TOTEXT to simplify the expressions. I was trying to keep all the triggers at the slide level so they can live on the base layout and individual checkbox widgets don’t need any logic that has to match the variable associated with that widget