I have a switch control linked to a SharePoint YES/NO field called "Result". I would like to use an if statement to label the control:
I have tried this in the OnChange Event but it's not working - any ideas why.
If(Result=true, UpdateContext({Compliant:"Yes"}), UpdateContext({Compliant:"No"}))
FYI: I'm using a text box to check the value of Compliant in run time for now. The textbox is set to Compliant as the default.
The values are true, false, and I couldn't get it to work. It would work for the false but not on change. I think I realized that I don't like that switch control. I converted to the radio buttons which make the selection more obvious.
Thanks for your help though.
I suspect it has to do with the type of that field. What shows up if you pipe the Result field into a Textbox instead of a toggle/switch? What values do you see? Are you seeing "true"/"false', or "Yes"/"No" ?
Based on that, the condition in your If invocation will need to adapt accordingly.
UpdateContext({ Compliant: If(Result, "Yes", "No") })
UpdateContext({ Compliant: If(Result = "YES", "Yes", "No") })
Also, have you considered eliminating the If() invocation altogether?
UpdateContext({ Compliant: Result })
I hope this helps.
WarrenBelz
89
Most Valuable Professional
MS.Ragavendar
58
Michael E. Gernaey
42
Super User 2025 Season 1