How to Auto Generate 9 Digit Alpha Numeric Code

10 years 4 months ago #237676 by naturallink
Replied by naturallink on topic How to Auto Generate 9 Digit Alpha Numeric Code
We would need only the 9 digit formatted number stored. Client is very specific about the UUID. Have been trying to convince them otherwise - if they used 13 digits would make life much simpler. Problem is they have to put the UUID on hard printed material some of which is quite small.

What i have asked client is if we can go with 13 digit for the beta, then ill tackle the 9 digit code later.

Please Log in to join the conversation.

10 years 4 months ago #237694 by krileon
You can have 9 digit if you want 9 digit. The below will generate ???-???-??? formatted random string.

CONCAT_WS( '-', SUBSTRING( REPLACE( UUID(), '-', '' ), 1, 3 ), SUBSTRING( REPLACE( UUID(), '-', '' ), 4, 3 ), SUBSTRING( REPLACE( UUID(), '-', '' ), 7, 3 ) )


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 years 4 months ago #237736 by naturallink
Replied by naturallink on topic How to Auto Generate 9 Digit Alpha Numeric Code
tried using this with auto actions query - placed above code in query action and upon registration we get error:0

Please Log in to join the conversation.

10 years 4 months ago #237802 by krileon
You can't directly copy and paste it. It's just a function usage. It's not a complete query. You need to implement its usage as either a select query or as an insert query to insert the value into the database.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.187 seconds

Facebook Twitter LinkedIn