How to retrieve value from SQL Server Action Results

Ramanarajan D 11 Reputation points
2023-07-06T12:16:50.69+00:00

Hello Folks,

I've a recurrence trigger followed by Execute store procedure (V2) action.

When I run that SP it will give an ID.

I'm trying retrieve the value(only value) from that Action.

I'm getting like [{"InvoiceID":"62134"}] But I want the value only. i.e. 62134

How can I achieve this? Is there any possibility to do this via expressions(fx)

One

Two

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,313 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Wilko van de Velde 2,226 Reputation points
    2023-07-06T12:36:12.76+00:00

  2. VenkateshDodda-MSFT 23,686 Reputation points Microsoft Employee
    2023-07-07T04:55:02.0833333+00:00

    @Ramanarajan D Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    If Stored Procedure in your workflow always return a single value then you can use the below expression to pull the InvoiceID

    body('Execute_stored_procedure_(V2)')?['resultsets_InvoiceID']?[0]?['InvoiceID']
    

    If your stored procedure returns multiple values, then as suggested by Wilko van de Velde you need to use ParseJSON and also Foreach loop to pull the InvoiceID value.

    Feel free to reach back to me if you have any further questions on this.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.