- OnStart() - App
- OnVisible(), OnHidden() - Screen
- OnSelect() - Button, Text, Label, Drop down
- OnCheck(), OnUncheck() - Checkbox
- and more
When you connect a Flow to these controls' properties, then the Flow gets triggered when that action is performed. For example, when you press a button or label, check or uncheck a Checkbox, or launch the PowerApp. In essence, PowerApp itself provides the trigger to all these Flows.
However, there are time, where you want something in PowerApp to occur when there is an external trigger. For example, you want to update information in your PowerApp when a Flic IoT button is pressed.
The way this can be accomplished is using a Timer control in your App and a dual-trigger Flow. Here's an example of how I built it..
The timer control, flicTimer, is responsible to do three things:
- Call the Flow
- When completed, perform an action inside the App and restart
Here's a description of the property settings I've used:
|Autostart||true||unless you need to manually invoke the listener Flow, start automatically|
|Duration||12000||make it long enough so that it wont time out, but not too short to cause multiple Flows to fire|
If(clicked = "clicked", <do something>);
|here's where you call the Flow and wait for a response. Once the Flow returned, I would perform a specific action|
|Repeat||true||if the Flow didn't finish in time, repeat the timer|
The Flow in this case is fairly simplistic. It begins with the PowerApp triggering it. Once triggered, the secondary trigger, When a Flic is pressed, is called to wait until the button is pressed. There are two possible outcomes to this:
- The button was pressed. In that case, the branch on the right is executed and returns the "clicked" response to the PowerApp.
- The button was not pressed. Here, the Flow will eventually time out and return an empty result to PowerApp.
A similar logic can be applied to other types of triggers that may not be easily accessible within your PowerApp.
Post a Comment