cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
00236123
Frequent Visitor

Random number as a Title on Customized SharePoint Forms

Hello Everybody,

 

As the subject says, I am trying to find a way for a random number to be part of my title column. My wish is tho have the title been generated automatically by a Concatenate syntax. This tile would be created based on...

  1. A selected value of a dropdown box. (Type_Of_Request)
  2. A random 6 digit number. (intRandomNumber)
  3. Another dropdown value. (Project_Title)

So far I have come up with the syntax below. Putting together the above points as a unique ID.

 

Concatenate(
Switch(Type_Of_Request.Selected.Value,"New Construction","N","Maintenance","M"),
"_",
intRandomNumber,
"_",
Project_Title
)

 

After I create and submit an entry on my SharePoint List the Id gets created as planned. But when I enter and change anything on the form, the number changes to different random number. 

The idea is to have the first random number be the same all the time for my group to have some unique ID when searching for it on the list.

 

I would appreciate any help with this matter.

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerRanger
Super User
Super User

@00236123 ok. So you have to distinguish when the Title field should generated and when it should show the actual value which got saved/submitted.

To do so you have to wrap your Formular inside an if statement which will Look like

 

If(Form1.Mode = FormMode.New,Concatenate(

Switch(Type_Of_Request.Selected.Value,"New Construction","N","Maintenance","M"),

"_",

intRandomNumber,

"_", 

Project_Title

),Parent.Default)

 

So when creating a new item you would generate your title field otherwise, when viewing or editing an existing item, you show the actual value of that record.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
PowerRanger
Super User
Super User

@00236123 Where did you apply the Formular?




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

The formula was added to the Title data card on the input box. The idea is to have  this Concatenate title automatically from the input entries of the formula.

 

I separately create the variable (intRandomNumber) to create the 6 digit random number. The variable seems to work. I just want the first random number form the initial submission to stay in the title.

 

Thanks.

PowerRanger
Super User
Super User

@00236123 ok. So you have to distinguish when the Title field should generated and when it should show the actual value which got saved/submitted.

To do so you have to wrap your Formular inside an if statement which will Look like

 

If(Form1.Mode = FormMode.New,Concatenate(

Switch(Type_Of_Request.Selected.Value,"New Construction","N","Maintenance","M"),

"_",

intRandomNumber,

"_", 

Project_Title

),Parent.Default)

 

So when creating a new item you would generate your title field otherwise, when viewing or editing an existing item, you show the actual value of that record.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

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.

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 (2,705)