cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnnaCICI_Z
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
v-xida-msft
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
v-xida-msft
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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (34,744)