cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshaySolanki
Helper II
Helper II

Different Auto increment IDs based on year value

Hello,

 

I have a sharepoint list where I am using the default ID column for my formula.

Basically I also have a year (text) column from which I need to apply some logic to generate a custom ID for the list item

If the year entered by user is 2022 then ID should start from 58 and continues 59,60... for the next 2022 year list item entries

If the year entered by user is 2023 then it should start from 2 and 3,4...so on for next 2023 list item entries

 

I am using Power automate right now for updates and for just 2022 year, I can create the formula fairly easily as it is just adding the number in the existing ID to sum it up to 58 and next entries will follow.

Issue rises when I have 2023 year entries as user can generate random year entries anytime so I cannot have 2 static number formulas for both years.

 

Thanks in advance

Akshay

3 REPLIES 3
lbendlin
Impactful Individual
Impactful Individual

If the year entered by user is 2022 then ID should start from 58

What made you choose that starting point? Wouldn't something like "Year times 1000" be a safer bet?

Actually the team already has 57 project assigned in year 2022 and as of now they have been doing manual excel entries to manage project name and IDs
Now I am building a SharePoint, PowerApp and PowerAutomate solution for them which also replace that excel spreadsheet so for that I need to pull all the previous data in the list too and start the new data from the continues number which is 58 for year 2022 projects and number 2 for year 2023 project

v-chengfen-msft
Microsoft
Microsoft

Hi @AkshaySolanki 

 

I've made a test for your reference:

 

Here is list:

vchengfenmsft_0-1663738578377.png

Here is flow:

vchengfenmsft_3-1663738759571.png

if(equals(first(body('Select_3')),null),1,add(max(take(body('Select_3'),add(length(body('Select_3')),-1))),1))

vchengfenmsft_5-1663739086182.png

 

 

Best Regards

Cheng Feng

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.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (4,239)