cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Flow with AUTO INCREMENT in a SharePoint List

Hello everyone,
My SharePoint list follow this structure:

TypeName
AAAExample
AAAExample
BBBExample
BBBExample
CCCExample
BBBExample



I'm trying to create a Flow that does the AUTO INCREMENT function for a given column in my SharePoint list.

In my SharePoint list, I have the Type column, which can only have 3 types of values ​​(AAA, BBB and CCC).


So whenever the user responds to a new Forms, the flow must first see what the Type is in the response sent and, according to the type, go to the list and capture the last value in the Increment column of this Type. With that information, the flow finally add the new item with the answer coming from Forms. For this newly inserted item, the Increment value must be the value of the last Increment of this type +1. The expected result should be something like the table below:

TypeNameIncrement
AAAExample1
AAAExample2
BBBExample1
BBBExample2
CCCExample1
BBBExample3

 

Can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User
Super User

Hi!

Once you get a new forms response, you need to identify its type (AAA, BBB or CCC)

Now, I would add a SP 'Get items' action block to read all items from your SP list.

Next, I would add a 'Filter Array' action block, assign as its input 'Get items Value' output. On Filter Array, I would add a condition to get all items whose type matches with current Forms Response.

Then, I would add a SP 'Create item' to store response related values as a new item on the SP list. Please note in order to assign the proper value to Increment column, you can use the following WDL expression:

add(length(body('Filter_array')),1)

THe point is,  length(body('Filter_array')) provides the nr of items in your SP list filtered, i.e. the nr of elements matching your current response type. So you just need to add 1

 

Hope his makes sense.

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

2 REPLIES 2
efialttes
Super User
Super User

Hi!

Once you get a new forms response, you need to identify its type (AAA, BBB or CCC)

Now, I would add a SP 'Get items' action block to read all items from your SP list.

Next, I would add a 'Filter Array' action block, assign as its input 'Get items Value' output. On Filter Array, I would add a condition to get all items whose type matches with current Forms Response.

Then, I would add a SP 'Create item' to store response related values as a new item on the SP list. Please note in order to assign the proper value to Increment column, you can use the following WDL expression:

add(length(body('Filter_array')),1)

THe point is,  length(body('Filter_array')) provides the nr of items in your SP list filtered, i.e. the nr of elements matching your current response type. So you just need to add 1

 

Hope his makes sense.

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Anonymous
Not applicable

This is perfect. Thank you very much 🙂

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (3,256)