Hello,
I'm looking for a solution for,
wanted action:
OnChange = IF(My.Value=true, ……then Toggle State turn ON…. , false)
Hi @I_need_help,
The best way to handle states would be via variables. You can set a variable in the OnStart of the app, or if it's literally a toggle you're meaning, set it during the OnVisible of the page the toggle is on. You can then link the variable name wherever you need it (such as the Default definition of the toggle) and set your code to OnChange = IF(My.Value=true,Set(MyVariableName,true), Set(MyVariableName,false))
Hello Sickle Cell,
thank you for your message.
To make the app more user friendly, there is a scenario where I want to use a function that triggers the "mouse click-click" toggle via formula logic without the user doing so.The switch should be changed from “false” to “true” or vice versa via a formula event.I think I would have to change the "Toggle.Default.Value" to do this. But I don't know a suitable formula.
Yeah, a variable is definitely the way to go. You would set the Toggle Default value as a variable (such as varName for example), then you can either Set a variable(if you want it as a global, and you can do this during the App OnStart) or use UpdateContext. In this instance, UpdateContext is likely better, as you can use the code of UpdateContext({varName:!varName}) which would swap the toggle as on or off every time the user triggers whatever function you attach that code too.
Can you give an example of your specific use case? If so, I can possibly tailor it more
So you want a toggle to change back and forth only if another value is true? If My.Value is true, then clicking this button will endlessly cycle varToggleState back and forth from true to false. The sets the variable to the opposite of what it currently is.
If( My.Value, Set(varToggleState,!varToggleState) )
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Chiara Carbone as our Community Spotlight for November…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 686 Most Valuable Professional
Michael E. Gernaey 433 Super User 2025 Season 2
wolenberg_ 266 Moderator