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!



View solution in original post

Anonymous
Not applicable

This is perfect. Thank you very much 🙂

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!

Top Solution Authors
Top Kudoed Authors
Users online (1,720)