Hi,
How to auto increment data in SP Online List. I have 19 data but it only store one data in a row and keep replacing the existing data.
It supposed to list all 19 data submitted through form submission and approval.
Hi @Anonymous, assuming you are not using the ID column in your SharePoint list for this then it can be achieved quite easily but needs a separate list to hold the next incremental value.
In this example we have our main list,CropHarvest, where the current highest incremental value is 971 which means that when we create a new item we want the next one to be 972:
1 Main List
We also have a list called Increment which holds the next value 972:
2 - Increment list with next value
The trigger in our flow is a SharePoint "When a new item is created". The first action is to get the items (there's only 1) from the Increment list:
Flow trigger and Get Increment list
We add an apply to each control and select value from the dynamic content box. We then add a Compose control and the input for this is the NextValue from Get items from the Increment list:
Apply to each and Compose
We now want to update our main list with the value in the Compose control we created above. So the outputs of that Compose are added to the Increment column. The Id is selected from the dynamic content and make sure you select the ID in the When an item is created section:
Update the main list
We then want to update the Increment list with the new NextValue. So we create a Compose control and use the expression
A few seconds after the flow has run when the new item is created you'll see that in the main list the column for the incremental value gets updated:
And the Increment list has also been updated with the next value:
Rob
Hi,
Given solution is quite contain many number of steps I have to include in my existing complex flow template.
Alternatively, can you show the steps if I used ID column to increase the data after approval get approved?
I'll try steps above again after I try this one.
You can't change the ID number so my example above is a way to do the increment even though it has quite a few steps.
Rob
Los Gallardos
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!