Dears,
How we can get all SharePoint list items without the last record using get Items ?
using filter query, order by, top count ?
Any idea
thanks
Solved! Go to Solution.
Hi @GhassSD ,
The Get_item_3 has only one value returned (and only one), so I think is it better to replace the Apply_to_each_5 action (and subsequent action) with a Set_Variable action ( from my point of view the flow is more readable in this way):
Name: LastMix
Value: body('Get_Item_3')['value'][0]['Mix']
Regarding the Get_Items_2 and the values is returning, change the filter query to:
Mix eq 'variables('LastMix')' and ID lt body('Get_Item_3')['value'][0]['ID'] (this will exclude the last ID). if it doesn't work as expected use Mix eq 'variables('LastMix')' and ID lt 'body('Get_Item_3')['value'][0]['ID']' ( i'm not quite sure if the returned value for ID is number type or string one).
Also I don't think that you need the Apply_to_each_6 action if you want to check if there are any other tems as the last one. It's enough to check inside if clause the length( body('Get_Items_2')['value']) against 0. (this means that the filter found/not found at least one record with the same Mix column as the last item in list).
Hope it helps !
@GhassSD what is the use case ? Why don't you want the last record ? How many items are present in the list ?
Dear,
I have this Share Point list, I need to check if the last record in 'Mix' column exist already before in the list, so directly the LOETime should be updated in the last record to be 0.5
In order to do this I need to create a flow that search in a SharePoint list for a special value without the last record inserted.
So I did my flow as below:
Getting the last record in Mix column:
Then getting the all list items that contain the last record in Mix:
Then Condition:
But 'Get Items 2' is giving all the record of the table in addition to the last record.
So the condition gives all the time true.
So our issue now is to get SharePoint list items without the last record ?
Any idea ?
Thank you in advance
Hi @GhassSD ,
The Get_item_3 has only one value returned (and only one), so I think is it better to replace the Apply_to_each_5 action (and subsequent action) with a Set_Variable action ( from my point of view the flow is more readable in this way):
Name: LastMix
Value: body('Get_Item_3')['value'][0]['Mix']
Regarding the Get_Items_2 and the values is returning, change the filter query to:
Mix eq 'variables('LastMix')' and ID lt body('Get_Item_3')['value'][0]['ID'] (this will exclude the last ID). if it doesn't work as expected use Mix eq 'variables('LastMix')' and ID lt 'body('Get_Item_3')['value'][0]['ID']' ( i'm not quite sure if the returned value for ID is number type or string one).
Also I don't think that you need the Apply_to_each_6 action if you want to check if there are any other tems as the last one. It's enough to check inside if clause the length( body('Get_Items_2')['value']) against 0. (this means that the filter found/not found at least one record with the same Mix column as the last item in list).
Hope it helps !
Dear @gabibalaban ,
Yes it solved,
I calculate the length:
If not equal to 1 so the value already exist, so the condition :
Best Regards,
@GhassSD ,
I gave you the long way solution 😊 ... to show that you can filter a Sharepoint list using multiple criteria on the same query.
Yes, in terms of number of actions and understandability (i don't know if a such word reallly exists) your solution fits more the great to your needs.
Good luck !
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Read the latest about new experiences and capabilities in the Power Automate product blog.
User | Count |
---|---|
25 | |
22 | |
9 | |
9 | |
7 |
User | Count |
---|---|
41 | |
35 | |
26 | |
21 | |
13 |