cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kmayes
Post Prodigy
Post Prodigy

Creating a value based on the last item in SP list

Hi Community

 

I have a flow that I have created that works well, the basis is that it gets items from one SP list, moves them to another, then removes it from the original list. Which is nice and straight forward and working well.

However, when I move it to the new list I want it to take the next ID No. in sequence. My thought was to use the expression last() but then this requires getting the items from the list I'm moving the item to which seems inefficient.

I hope this is a clear description to my dilemma, Is anyone able to support?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Kmayes,

 

OK, you could follow these steps to format the number:

last(split(outputs('Compose'),'-'))
int(outputs('Compose_2'))
add(outputs('Compose_3'),1)
concat('AB-',outputs('Format_number')?['body'])

Screenshot 2020-10-28 175302.jpg

 

Screenshot 2020-10-28 175329.jpg

Run result:

Screenshot 2020-10-28 175233.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-litu-msft
Community Support
Community Support

Hi @Kmayes,

 

You could use Get items with Order By the "No." column, set the Top count to 1 to get the last 1, then use add() function to add 1 based on the last No. column.

No_x002e_ desc
add(outputs('Compose'),1)

Screenshot 2020-10-28 154928.jpg

 

Screenshot 2020-10-28 154950.jpg

 

Screenshot 2020-10-28 155323.jpg

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft 

 

Thank you, this works to a degree for me, however im unable to use the add function as the Id column is not a number column its text as it a mixture of text and numbers.

So for example my ref could be AB-001 so i have tried to use compose to split the ref take the last part of the ref then add 1 to it but it still sees it as a string value rather than an integer. Any further advise would be greatly appreciated

 

Kmayes_0-1603876949774.png

 

Hi @Kmayes,

 

OK, you could follow these steps to format the number:

last(split(outputs('Compose'),'-'))
int(outputs('Compose_2'))
add(outputs('Compose_3'),1)
concat('AB-',outputs('Format_number')?['body'])

Screenshot 2020-10-28 175302.jpg

 

Screenshot 2020-10-28 175329.jpg

Run result:

Screenshot 2020-10-28 175233.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft 

 

Perfect thank you 😊

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (5,737)