In this post, I want to show how easy it is to call a Flow from a Power App. The goal of the Power App is to pass values to the Flow, have it add them together, and return a result.
Starting from the Power Apps portal
click Create –> Blank app, Black canvas app, name the app, for the format option, select tablet, then click Create button.
Power App overview:
Field Type | Field Name | Option |
---|---|---|
Text Input | TextInputOne | Format: Number |
Text Input | TextInputTwo | Format: Number |
Label | LabelNumberOne | |
Label | LabelNumberTwo | |
Label | LabelTotal | |
Label | LabelMathResult | |
Button | ButtonCalc |
Flow overview:
The Flow can be created directly in the Power App designer or the Power Platform portal. For this example, I’m going to use the portal.
From https://make.powerapps.com,
Click on New flow and select Automated cloud flow
Click the Skip button at the bottom of the window (this will make sense in a min.)
With the Flow designer open, click PowerApps or search for it, then click on PowerApps (V2)
In this step, add two number inputs to the action
I named my number inputs as follow: inputNumberOne and inputNumberTwo
The Flow will respond to the app using the Repost to a PowerApp or flow action. For the output, again select number, and I named mine outputNumber .
the formula should be: add(triggerBody()[‘number’],triggerBody()[‘number_1’])
Name the Flow as Flow do Math, and save it. You can test the Flow simply by clicking the Test button and supplying two input values. The Flow can be named something different, but this name aligns with the below example.
Back in the PowerApp, click the Power Automate icon.
With the Power Automate window open, click on Add flow and select the newly created Flow, or search for it and select it.
On the app design surface, select the button and update its OnSelect property to:Set(varNumber, FlowDoMath.Run(TextInputOne.Text,TextInputTwo.Text).outputnumber)
Select the LabelMathResult field and set its Text value to varNumber
Run the app, input values in the text fields, then click the button.
What just happened?
The values of the two text input fields were passed to the Flow, it added them together and returned the value in the outputnumber field; that value was then set to the varNumber variable.
In future posts, I will dive deeper into more complex examples.