cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
David59740
Helper II
Helper II

PowerApp breaks every time I add a schema to 'Response' action in the connected flow

I have a PowerApp that connects to a Power Automate Flow. When an image is uploaded to the PowerApp the flow is triggered. The flow connects to a Form Recognizer API and I am trying to get the response back to PowerApps so I can use the data in the app. So essentially my flow is connected to the app, I can connect to the API in the flow, and everything is fine. Then I add a Response action to the flow and everything is still fine. When I add a schema to the Response action the flow disconnects from the PowerApp which I've gathered is normal. My issue is I cannot connect the flow back to the app even after the schema has changed and the flow is removed. I keep getting this error message:

 

Unable to add flow

There was a problem adding your service. Please try again later.

Session ID: (SessionID)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

I was able to get all that information except the Merchant Name.  I don't see a Merchant Name in the output anywhere.  Also, just to verify, you just wanted the overall receipt details and confidence levels for each item.  The individual list of items ordered is in there also, but that would be a different array.  The Key was to process just the documentResults array from the JSON and then do a Data Select on it to get the values you needed. This doesn't include all the confidence levels, but the one for Time is included to show that it would work.

image.png

This is the resulting data collection in Power Apps

image.png

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

14 REPLIES 14
Pstork1
Dual Super User
Dual Super User

This is normally caused by some problem with the schema.  For example, do you have any properties in the schema where there are multiple types or data values that might be null?  Both of these can cause issues.  I normally find that its a good practice to clean your data in the flow before sending it back to Power Apps.  Using a combination of Data Select (to filter out unnecessary columns), filer array (to remove rows with null values) , and parse JSON to re-parse the new array of data before sending it back to Power Apps.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
David59740
Helper II
Helper II

{
"type": "object",
"properties": {
"status": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"lastUpdatedDateTime": {
"type": "string"
},
"analyzeResult": {
"type": "object",
"properties": {
"version": {
"type": "string"
},
"readResults": {
"type": "array",
"items": {
"type": "object",
"properties": {
"page": {
"type": "integer"
},
"angle": {
"type": "number"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"unit": {
"type": "string"
}
},
"required": [
"page",
"angle",
"width",
"height",
"unit"
]
}
},
"documentResults": {
"type": "array",
"items": {
"type": "object",
"properties": {
"docType": {
"type": "string"
},
"pageRange": {
"type": "array",
"items": {
"type": "integer"
}
},
"fields": {
"type": "object",
"properties": {
"Items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueArray": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueObject": {
"type": "object",
"properties": {
"Name": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueString": {
"type": "string"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array"
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"Quantity": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueNumber": {
"type": "integer"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"TotalPrice": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueNumber": {
"type": "integer"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
}
}
}
},
"required": [
"type",
"valueObject"
]
}
}
}
},
"MerchantAddress": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueString": {
"type": "string"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array"
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"MerchantPhoneNumber": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valuePhoneNumber": {
"type": "string"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"ReceiptType": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueString": {
"type": "string"
},
"confidence": {
"type": "number"
}
}
},
"Subtotal": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueNumber": {
"type": "integer"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"Tax": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueNumber": {
"type": "number"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"Tip": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueNumber": {
"type": "number"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"Total": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueNumber": {
"type": "number"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"TransactionDate": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueDate": {
"type": "string"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
},
"TransactionTime": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"valueTime": {
"type": "string"
},
"text": {
"type": "string"
},
"boundingBox": {
"type": "array",
"items": {
"type": "integer"
}
},
"page": {
"type": "integer"
},
"confidence": {
"type": "number"
}
}
}
}
}
},
"required": [
"docType",
"pageRange",
"fields"
]
}
}
}
}
}
}

 

 

 

 

 

 

This is my schema, I've tried filtering and using the select action and I am still stuck, maybe I'm dumb but I cannot identify the issue with this

How did you get the schema?  Did you generate it using the Generate schema from sample button?  The first thing I noticed is that there are several required: sections.  To the best of my knowledge Power Apps/Power Automate only allow one.  I think you have more than one data set schema embedded here and I suspect that is the problem.  



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Shujaath_Khan
Super User
Super User

Hi @David59740 ,

 

  1. Assume we pass the response as-is from Power Automate.
  2. and from PowerApp you can try to save the response in the collection

 

ClearCollect(colName, FlowName.Run("JSON Data you want to convert to a collection"))

 

Thanks

Thanks for the response @Pstork1. Yes I am generating as sample from the results of the GET request and it is bringing back the before mentioned schema.

If its not sensitive information could you post a sample of the data you are getting back from the Get Request?  I'll try to help with how to clean it up.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 I apologize for the format, the website would not let me upload since it exceeded the data limit.

 

 

Ok, I've got the sample data.  What specific data/fields are you trying to get back to use in Power Apps?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

MerchantName, MerchantAddress, MerchantPhoneNumber, Subtotal, Tax, Tip, Total TransactionDate, TransactionTime

 

And all confidence levels associated with each.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,871)