web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Generate ID depending ...
Power Apps
Answered

Generate ID depending on a year

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I don't have an idea where or how should I start doing this ID generating. Idea is to have unique ID's depending on the Start Date which is stored in SP List. ID looks like this YYXX-001-999 if current start date is 2022 then ID should be 22XX-041 and going up. If we have project start 2023 and for example this is our first project that starts in 2023 then ID should skip the 22XX-041 and start new iteration for 2023 which is 23XX-001 and going up.

Categories:
I have the same question (0)
  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @Anonymous ,

    You can use the below function in Screen's on Visible property - Set(varYear2,Right(Year(Today()),2));If(IsEmpty(Filter(Holidays,StartsWith(UniqueID,varYear2))),Set(varUniqueID,varYear2 & "XX-" & "000"), Set(varUniqueID, varYear2 & "XX-" & Text(Value(First(Sort(Holidays,Created,Descending)).UniqueID)+1,"000")))

    And in your ID datacard set the default value to - If(Form1.Mode=FormMode.New, varUniqueID, Parent.Default)

  • Community Power Platform Member Profile Picture
    on at

    Hey thank you for quick response. I tried it and it works with new year but I believe this Set(varUniqueID, varYear2 & "XX-" & Text(Value(First(Sort(Holidays,Created,Descending)).UniqueID)+1,"000"))) gives me 001 for some reason instead of adding to last value

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @Anonymous ,

    Please find below updated formula - 

    Set(varYear2,Right(Year(Today()),2));If(IsEmpty(Filter(Holidays,StartsWith(UniqueID,varYear2))),Set(varUniqueID,varYear2 & "XX-" & "000"), Set(varUniqueID, varYear2 & "XX-" & Text(Value(Right(First(Sort(Holidays,Created,Descending)).UniqueID,3)+1),"000")))

  • Community Power Platform Member Profile Picture
    on at

    It increments the ID but the wrong one.

    You can see in the image we have ID 2260-331 so if start date is 2022 then we should make next ID 2260-332 and doesn't mind that there is IDs before

    LukasSliuzas_0-1668002821092.png

     

  • Verified answer
    NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Can you try using below formula - 

    Set(varYear2,Right(Year(Today()),2));If(IsEmpty(Filter(Holidays,StartsWith(UniqueID,varYear2))),Set(varUniqueID,varYear2 & "XX-" & "000"), Set(varUniqueID, varYear2 & "XX-" & Text(Value(Right(First(Sort(Filter(Holidays,StartsWith(UniqueID,varYear2)),Right(UniqueID,3),Descending)).UniqueID,3)+1),"000")))

  • Community Power Platform Member Profile Picture
    on at

    Looks good so far. I will do some testing

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard