cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pastre
Frequent Visitor

Get existing item

I have a three column sharepoint list (Title=string, Usuario=string and Servidor=integer from 1 to 5). When a new item is added the Server column must be incremented by 1. When it is 5 the count must start from 1 again.

 

The problem is that: When a new item is inserted I look for the ID of the penultimate item in the list to increment the "Servidor" column. However, if the penultimate item is deleted, the error "item not found" is returned. I'm not able to continue the search until I find the last existing record.

 

Any idea how to do this?

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
JefferNi66
Regular Visitor

Hi @Pastre ,

 

You can use the First/Last functions to get the record and know its server number:

First(Sort(SharePointList, ID, Descending).Servidor

or

Last(Sort(SharePointList, ID, Ascending).Servidor

 

BR,

Jeff

View solution in original post

1 REPLY 1
JefferNi66
Regular Visitor

Hi @Pastre ,

 

You can use the First/Last functions to get the record and know its server number:

First(Sort(SharePointList, ID, Descending).Servidor

or

Last(Sort(SharePointList, ID, Ascending).Servidor

 

BR,

Jeff

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 Solution Authors
Users online (3,574)