Hello - I have a toggle control with the Default set to 'Connection.connected' so I can automatically switch to saving to a collection when offline (as per other established canvas apps). I also use the toggle to override certain online saving options popping up when users are in poor signal range and they would prefer to keep collecting information onto the device. That's working fine when working on the screen where the toggle is - however when on another screen I would like to be able to toggle that same control in the same way from that second screen. I've seen solutions where the default value of Toggle is set to a variable but I want to keep that default value as Connection.connected to maintain the online/offline functionality. I'm looking for something simple to resolve this - I can Reset(Toggle) but it resets to the toggle value connection.connected when online and I want to overide that. Hoping someone can help me out with a solution. Cheers, Thommy
Solved! Go to Solution.
Hi, I think there is no other way then setting the Default to a global variable.
At App.OnStart you should set the global variable like Set(varConnected; Connection.connected).
On other places in the app you can change the toggle value e.g. like Set(varConnected; !varConnected).
That way the code behind the OnChange event of the toggle gets executed. I use this method a lot for refreshing datasets, fire Power Automate flows etc. And because it is a global variable it is not restricted to the form that holds the toggle object.
You think this could work in your situation?
Kind regards,
Maurits
Hi, I think there is no other way then setting the Default to a global variable.
At App.OnStart you should set the global variable like Set(varConnected; Connection.connected).
On other places in the app you can change the toggle value e.g. like Set(varConnected; !varConnected).
That way the code behind the OnChange event of the toggle gets executed. I use this method a lot for refreshing datasets, fire Power Automate flows etc. And because it is a global variable it is not restricted to the form that holds the toggle object.
You think this could work in your situation?
Kind regards,
Maurits
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
259 | |
126 | |
86 | |
85 | |
68 |