cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AnnaCICI_Z
Level: Powered On

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 Team
Community Support Team

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

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

AnnaCICI_Z
Level: Powered On

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

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 Team
Community Support Team

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

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

AnnaCICI_Z
Level: Powered On

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

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" ?

AnnaCICI_Z
Level: Powered On

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

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 134 members 2,056 guests
Please welcome our newest community members: