I'm currently trying to figure out how to fetch only a single row from an SQL view using Power Automate. I'm aware of the "Get row" action, but it seems to be limited to SQL tables and doesn't list views as an option.
On the other hand, the "Get Rows" action does include views. However, my challenge arises when I attempt to use the values fetched. Even though I specify that I want only the top row by setting the limit to 1, Power Automate automatically generates an "Apply to each" action.
Is there a way to prevent the creation of the "Apply to each" action when I'm only interested in the first row from the view?
Any advice or workarounds would be greatly appreciated!
That worked, thanks
If there is only one item returned, the loop really isn't hurting anything.
One way to avoid the loop is by using the first() expression. See my example below. I am using SharePoint but it shouldn't matter.
Here are the expressions that I use - I am retrieving the title column
first(outputs('Get_items')?['body/value'])
outputs('Compose')['Title']
Another way to do this is to reference the first element in the collection [0]
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional