cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

How to display the result of SQL Server (on-prem) stored procedure in PowerApps

I use Flow to run a SQL Server stored procedure (on-prem), then I need the result to display in PowerApps.

Following this article (Return an Array from Flow to PowerApps (Response Method), I get the right result in Flow, but PowerApps collection cannot get the same result. 

PowerApps collection gets always "True".

Flow :

2.png

 

 

 

Result of Flow :

1.png

 

 

PowerApps : 

When click on a button, send variable and then run Flow

3.png

 

 

Stored procedure

ALTER procedure [dbo].[ByMail]
@mail as varchar(50)
as

SELECT TOP 10 [ID]
,[DATE]
,[Hour]
,[User]
,[Email]
FROM [dbo].[Request] where EMail = @mail

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support
Community Support

Hi @AnnaCICI_Z,

Could you please expand the "Response" action within your flow?

Do you mean that the _demandeTable collection only return true?

I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:

Flow's configuration:1.JPG

Within the "Response" action, set the Body field to following:

body('Execute_stored_procedure')?['ResultSets']?['Table1']

Set the Response Body JSON Schema field to following:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Id": {
                "type": "integer"
            },
            "EmpName": {
                "type": "string"
            },
            "EmpEmail": {
                "type": "string"
            },
            "EmpDept": {
                "type": "string"
            }
        },
        "required": [
            "Id",
            "EmpName",
            "EmpEmail",
            "EmpDept"
        ]
    }
}

The flow executes successfully as below:2.JPG

 

App's configuration:3.JPG

Set the OnSelect property of the "Collection" button to following:

ClearCollect(RecordsCollection,'20181224_case2'.Run("PowerApps"))

The RecordsCollection as below:4.JPG

The user @doubles has also faced same issue with you, please check my response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Issue-executing-a-SQL-SP-with-a-response-to-P...

 

Please check if you have typed proper formula within the Body field of the "Response" action in your flow.

In addition, please also check if you have typed proper Response Json Schema within the Response Body JSON Schema field of the "Response" action.

If the issue still exists, please consider take a try to re-create your flow based on above solution I provided, then re-create a new connection within your app, trigger your flow again from your app, check if the issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi Kris, I found why I cannot get the right result in PowerApps.

Because PowerApps cannot update the modifications of Flows automatically, I should switch flows in PowerApps for getting the last version. Smiley Very Happy

View solution in original post

3 REPLIES 3
Community Support
Community Support

Hi @AnnaCICI_Z,

Could you please expand the "Response" action within your flow?

Do you mean that the _demandeTable collection only return true?

I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:

Flow's configuration:1.JPG

Within the "Response" action, set the Body field to following:

body('Execute_stored_procedure')?['ResultSets']?['Table1']

Set the Response Body JSON Schema field to following:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Id": {
                "type": "integer"
            },
            "EmpName": {
                "type": "string"
            },
            "EmpEmail": {
                "type": "string"
            },
            "EmpDept": {
                "type": "string"
            }
        },
        "required": [
            "Id",
            "EmpName",
            "EmpEmail",
            "EmpDept"
        ]
    }
}

The flow executes successfully as below:2.JPG

 

App's configuration:3.JPG

Set the OnSelect property of the "Collection" button to following:

ClearCollect(RecordsCollection,'20181224_case2'.Run("PowerApps"))

The RecordsCollection as below:4.JPG

The user @doubles has also faced same issue with you, please check my response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Issue-executing-a-SQL-SP-with-a-response-to-P...

 

Please check if you have typed proper formula within the Body field of the "Response" action in your flow.

In addition, please also check if you have typed proper Response Json Schema within the Response Body JSON Schema field of the "Response" action.

If the issue still exists, please consider take a try to re-create your flow based on above solution I provided, then re-create a new connection within your app, trigger your flow again from your app, check if the issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi Kris, thank you very much. 

 

I double check my Flow and my PowerApps button, I did exactly as you said. But I always get "True" in my RecordsCollection. 

 

In your PowerApps, how do you configure your recordsCollection ? Just use "ClearCollect" ?

Hi Kris, I found why I cannot get the right result in PowerApps.

Because PowerApps cannot update the modifications of Flows automatically, I should switch flows in PowerApps for getting the last version. Smiley Very Happy

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,374)