True/false toggle linked to a text variable?

Hello,
I am trying to bind a toggle item to a data variable.
If the data variable is the usual true/false this is very simple but my data source is a “yes”/“no” text field.
Is there a way to create a two way binding with inversible formula to make sure that “toggle true” <-> “yes” and “toggle false” <-> “no” ?
This has to be two ways to load and update the data so a simple if does not seem to work as it is not inversible.
Kind regards,
Emeric

I understand what you mean, and its possible, but its over complicated to do it that way, i suggest you change the data variable from yes/no to true/false in your database and then use a simple if function to display it. this way, changing the variable is simple too

If you still want to do it that way let me know

Ok thanks, I will adjust the database. Just curious, do you use inversible formulas ?

there is not one way, it depends on the situation, for example in your case, to do that you would need to have a true/false page variable (because the toggle uses true/false value) that is set when the page is mounted depending on the variable yes/no and then, to change the value, every time the toggle was used, you would need to check if the value is true then set the data to yes and if the value is false set the data to no.
But changing the way the value is set in the database, makes it easier in general to work with.

Ok thanks for the feedback

1 Like