Toggle Component

Is there a good resource for understanding toggle button logic? I’m trying to assign a t/f value to a text value however the toggle button will not stay “actuated” in the test environment. I can’t seem to get buttons to default “on” nor can I update the list item record to change the t/f value when tapped.

Thank you!

Hi John, sorry for the late reply! Were you able to figure out the toggle button logic or would you still need some clarification on the topic?

I was not able to figure it out and am still waiting for help, thank you

Hi, I made a quick example, maybe this will help:

I have a page variable that is a list of objects with an id (text) and a true/false value, with some initial data:

Then I have a toggle list item, repeated with the toggleList page variable. The content is bound to "Property of item in repeat > id", and the value (true/false) is bound to "Property of item in repeat > value".

The outcome is a list that displays the ids and values of the items in toggleList, and the toggles can be used to change the values because they are bound to the value property of each item.

1 Like

When i try to use dynamic true/false returned from an api, it does not work.

I tried to repeat through the data returned from my api to list the toggle label and value but it did not worked.
value=true or false, returned from api based on the query from database.
value is an object variable

I used this current.value in toggle component and it does nothing.
I also tried this IS_EQUAL(current.value,‘true’) but it shows this error “This binding requires an inversible formula”

Please help me and show how can i populate toggle list from some records returned from an api? Remember the toggle value will be true or false which is returned by the api in a json array.

Thanks for your help.

Instead of repeating the toggle button, set the value of the toggle to

Variablereturnedfromapi.truefalse_field.

If i not repeat the toggle button then how it will come for each row? Please help. I am still facing that problem. Please explain with a screenshot if possible.

I did this but it is not working.
appVars.objProjectInitiationQuestion.answer

answer id the true/false field returned from api.