I have a toggle component, based on which I want to run different queries.
Toggle is on > query A
Toggle is off > query B
What’s the best way to do it?
I have a toggle component, based on which I want to run different queries.
Toggle is on > query A
Toggle is off > query B
What’s the best way to do it?
Hi @Sara, Welcome to Retool Community.
I understand the issue you're facing. If your goal is to trigger different queries when a toggle is switched on or off, you can achieve this using On Change event handlers.
For example:
switch1.value === true
switch1.value === false
This way, when the toggle is turned on, the first query will run, and when it is turned off, the second query will run.
I've attached screenshots below showing the configuration:
I hope this helps! Let me know if you need any additional assistance.