cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SachinG31
Helper V
Helper V

Unique ID Format

Hello Experts,

 

I want to setup unique ID format in my Activity ID filed , This way

 

Username-BG-Sequence Number, the last sequence number will increase only. 

I tried using this formula on default property of field but its not working. App stores data in SP list BG Activity Recorder , format formation is happening but it not increasing the last number.

For Example last Activity ID in SP list was  BEE Power BI-BG-950 so next should be BEE Power BI-BG-951 but its again picking BEE Power BI-BG-950 PLease advise

 

 

If(Frm_02.Mode=FormMode.Edit,
User().FullName&"-BG-"&First(Sort(AddColumns([@'BG Activity Recorder'],"NewCol",
  Trim(Substitute('Activity ID',"BG-",""))*1),NewCol, Descending)).NewCol+1,Parent.Default)

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @SachinG31 ,

 

Please try this formula:

If(Frm_02.Mode=FormMode.Edit,User().FullName&"-BG-"&First(Sort(AddColumns([@'BG Activity Recorder'],"NewCol",Value(Trim(Mid('Activity ID',Find("BG-",'Activity ID')+3)))),NewCol,Descending)).NewCol+1,Parent.Default)

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

Hello @v-xiaochen-msft ,

 

thanks for your time and support , i am using below formula and it is working good as per my requirement.

If(Frm_02.Mode=FormMode.Edit,Dropdown13.SelectedText.Result&"-BG-"&First(Sort(AddColumns([@'BG Activity Recorder'],"NewCol",
  Trim(Substitute('Activity ID',Left('Activity ID',Find("-",'Activity ID',Find("-",'Activity ID')+1)),""))*1),NewCol, Descending)).NewCol+1,Parent.Default)

 

View solution in original post

4 REPLIES 4
v-xiaochen-msft
Community Support
Community Support

Hi @SachinG31 ,

 

Could you tell me:

When do you want to get and use ’Activity ID+1‘ ? (Editform or Newform?)

What control do you use to display the Activity ID? (Lable or Textinput or anything else)? 

When the displaymode of the form is edit, does it still fail to display the correct activity ID?

 

Best Regards,

Wearsky

Hello @v-xiaochen-msft , Thanks  for your response. Please find my comments below

When do you want to get and use ’Activity ID+1‘ ? (Editform or Newform?), when form is in Edit mode 

What control do you use to display the Activity ID? (Lable or Textinput or anything else)? , Its Text in put data card

SachinG31_0-1628255524894.png

When the displaymode of the form is edit, does it still fail to display the correct activity ID? Yes. 

 

Actually i tried this formula below.

 

If(Frm_02.Mode=FormMode.Edit,
User().FullName&"-BG-"&First(Sort(AddColumns([@'BG Activity Recorder'],"NewCol",
  Trim(Substitute('Activity ID',User().FullName&"-BG-",""))*1),NewCol, Descending)).NewCol+1,Parent.Default)

 

and now it is increasing the only last number on behalf of last available activity ID in SP list , but only for the user1. for User2 it is starting from 1 again.

For Example when logged in by user1 and last inserted Activity ID in SP list is User1-BG-950, so it takes User1-BG-951 and next 1 User1-BG-952, which is correct, but when user2 logged in it takes ActivityID as User2-BG-1.

My App is multi user and more than 30 users uses it. 

i want to continue by last inserted Activity ID in SP list +1 , regardless which users logged in. like for User2, i was expecting User2-BG-953, if last inserted ID by any user in SP list is UserN-BG-952

 

v-xiaochen-msft
Community Support
Community Support

Hi @SachinG31 ,

 

Please try this formula:

If(Frm_02.Mode=FormMode.Edit,User().FullName&"-BG-"&First(Sort(AddColumns([@'BG Activity Recorder'],"NewCol",Value(Trim(Mid('Activity ID',Find("BG-",'Activity ID')+3)))),NewCol,Descending)).NewCol+1,Parent.Default)

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Hello @v-xiaochen-msft ,

 

thanks for your time and support , i am using below formula and it is working good as per my requirement.

If(Frm_02.Mode=FormMode.Edit,Dropdown13.SelectedText.Result&"-BG-"&First(Sort(AddColumns([@'BG Activity Recorder'],"NewCol",
  Trim(Substitute('Activity ID',Left('Activity ID',Find("-",'Activity ID',Find("-",'Activity ID')+1)),""))*1),NewCol, Descending)).NewCol+1,Parent.Default)

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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