In the last two posts (Post1 and Post2), the process of how to set up a simple Power Apps for the aim of converting the image to text has been explained. The created Power Apps capture a picture from a receipt or any text. Also, how to create a flow that received the image from the Power Apps then pass it to the OCR component in Microsoft flow has been explained.
In this post, we are going to show how to connect these two components to each other. As you remember we created a Microsoft Flow and name it FlowAppsOCR, moreover the flow the last component send back the result to Power Apps via variable OCRResult.
Then, back to Microsoft Flow click on the Image Processing and make sure the ONSelect properties has been selected. Then click on the Action at the top of the page, then click on the Flow, now in the list that has been appeared you able to see the flows that have been created ( in the same account).
Click on the FlowAppsOCR then a formula will appear in the formula bar as below
FlowAppOCR.run(
The flow that has been created there need a variable to pass. We need to pass the taken image in Power Apps to this function.
As you remember from the first post the image has been saved and shown in a label named: Image1 then we need to call the output of the flow that has been identified in created flow, ocrresult.
The function : FlowAppsOCR.Run(Image1).ocrresult
Return a text has been identified in the Flow.
We want to show this to the use in Power Apps, as a result, there is a need to assign it to a variable using a Set function.
Set(TextResultOCR, FlowAppsOCR.Run(Image1).ocrresult )
So the result of the OCR has been saved in the TextResultOCR variable. To show it to their user, we are going to create a new Lable. Click on the Insert option and choose the Label.
As it can be a long test we need to make the label much bigger and able to scroll, hence click on the properties Overflow then type Scroll.
Now choose another property of the image and choose the Text then write: TextResultOCR
Now you able to run the Power Apps, click on the Run button at the top of the page, put a paper recipe or any image with text infron of the camera and then click on the Image Processing. After a while, the text will appear.
Some note:
1- Before running anything, make sure you already created an OCR component in Azure [1]
2- Be sure you run the Power Apps and Flow in the same account
3- Make sure you have access to the Sharepoint folder
4- Make sure in Microsoft Flow it is running properly by testing it.
This is awesome!!
Thanks for your work on this, I am struggling to get my app working having followed the instruction above I am constantly getting “Invalid number of argument received 1 expected 2”, for my button any idea what I have done wrong
Set(varOCR, OCRTest.Run (Image1).ocrtext)
You are welcome, please check the flow, also sometimes delete the bottom and add again it works