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

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.

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

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,996)