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

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
Community Champion
Community Champion

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
Community Champion
Community Champion

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

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]

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Kudoed Authors
Users online (6,350)