About UNIQUEID()

hello dear all, some of my UNIQUEID() field shows like 【3.02E+04】but【f10738b3】,and it’s randomly happened. how to fix this problem?

by the way, there are over 10000 column in my date sheet, and the database based on google sheet. thanks!

2 Likes

To avoid this situation with gSheet, adding a letter before the UNIQUEID() itself like “A”&UNIQUEID(). This will take care that gSheet can’t recognize it as a number like 12345E02.

3 Likes

@retreat_Ieyasu
As a side note to @Aleksi’s explanation; please check that the column in your gSheet is formatted as Plain Text as well. When set as automatic, gSheet will treat IDs such as 12345E02 as exponential numbers

5 Likes

Thanks for raising this question, @retreat_Ieyasu! I had the same problem myself (and it caused a problem in the functioning of my app). I was about to post an inquiry but your inquiry saved me the trouble.

Perhaps it would be good if AppSheet could tweak the UNIQUEID() algorithm so that a letter was automatically placed at the beginning, regardless of whether or not the gSheet column is set to plain text.

1 Like

Aesthetically, I’d like to maintain the random appearance of the UNIQUEID() key in my app. Even the students who copy my app probably won’t notice or care about it, but I somehow still care about the appearance. So, here’s my solution:

concatenate(INDEX({“a”,“b”,“c”,“d”,“e”,“f”,“g”,“h”,“i”,“j”,“k”,“l”,“m”,“n”,“o”,“p”,“q”,“r”,“s”,“t”,“u”,“v”,“w”,“x”,“y”,“z”},randbetween(1,26)),uniqueid())

This randomly picks one of the 26 letters of the alphabet as the first letter. It also slightly enhances the “uniqueness” of the randomly generated uniqueid().

1 Like

Equivalent, but shorter:

(mid(“abcdefghijklmnopqrstuvwxyz”, randbetween(1, 26), 1) & uniqueid())
3 Likes

thanks your help!

2 Likes