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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA 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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (56,564)