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

Condition to compare only the first record in a result set

My flow is executing a stored proc and it always returns 2 records. I want a condition that only looks at a specific column value in the first record rather than a foreach which applies the condition for both the records.

 

Current condition: @equals(items('Apply_to_each')?['AverageDurationSecDBExe'], '10')

 

Is this possible by modifying the syntax above to look at only the first row? My output is just a resultset from a storedproc.

 

Thanks,

Arun

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @armanika11,

 

Could you please share a screenshot of your flow’s configuration?

Could you show a bit more about the result that the stored procedure returns in flow?

Further, could you please share more details about your stored procedure?

I have made a test on my side and the flow's configuration as below:12.JPG

 The flow works successfully as below:2.JPG

 

13.JPGIf you want to achieve first record, please take a try with the following formula:

@first(body('Execute_stored_procedure')?['resultsets']?['Table1'])

Then achieve the specific column value in first record:

@first(body('Execute_stored_procedure')?['resultsets']?['Table1'])?['ColumnName']

Note: You can upload a pbix file to Onedrive or any web storage and share the link. Do mask sensitive data before uploading

 

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

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @armanika11,

 

Could you please share a screenshot of your flow’s configuration?

Could you show a bit more about the result that the stored procedure returns in flow?

Further, could you please share more details about your stored procedure?

I have made a test on my side and the flow's configuration as below:12.JPG

 The flow works successfully as below:2.JPG

 

13.JPGIf you want to achieve first record, please take a try with the following formula:

@first(body('Execute_stored_procedure')?['resultsets']?['Table1'])

Then achieve the specific column value in first record:

@first(body('Execute_stored_procedure')?['resultsets']?['Table1'])?['ColumnName']

Note: You can upload a pbix file to Onedrive or any web storage and share the link. Do mask sensitive data before uploading

 

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,499)