cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
John_alcan
New Member

Delete the last row on SP list

Hi, 

I want to delete the last row on SP list.

Is it possible?

Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
manuelstgomes
Super User
Super User

HI @John_alcan 

 

There are two ways to do this:

1. If the last is based on something you can sort, then you can use the Order By and then limit to just one record. Then delete it.

2. If not, you can fetch the items and have a condition that checks if the current item is the last one. To do this, define a variable and increment it each time the Loop runs. In each compare, if the variable is lower than the length. If it is continue, if not delete.

2020-08-19 10_43_31-Create your flow _ Power Automate.png

 

length(outputs('Get_items')?['body/value'])

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Mrmus
New Member

you can use length property to get length.

i.e length(body('Get_Item')).

this will give length and after we need to minus by -1 form length to get item

i.e item(body('Get_Item')['Value'][length(body('Get_Item'))-1]

View solution in original post

2 REPLIES 2
manuelstgomes
Super User
Super User

HI @John_alcan 

 

There are two ways to do this:

1. If the last is based on something you can sort, then you can use the Order By and then limit to just one record. Then delete it.

2. If not, you can fetch the items and have a condition that checks if the current item is the last one. To do this, define a variable and increment it each time the Loop runs. In each compare, if the variable is lower than the length. If it is continue, if not delete.

2020-08-19 10_43_31-Create your flow _ Power Automate.png

 

length(outputs('Get_items')?['body/value'])

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Mrmus
New Member

you can use length property to get length.

i.e length(body('Get_Item')).

this will give length and after we need to minus by -1 form length to get item

i.e item(body('Get_Item')['Value'][length(body('Get_Item'))-1]

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,164)