Hello,
I am building an app and when a user create a new entry I auto compute a column (client_code) from the content of a column (client_id). Here is an example of what I would like:
client_id = 8, client_code = HL2020-008
client_id = 18, client_code = HL2020-018
client_id = 158, client_code = HL2020-158
I can easly make the concatenation (โHL2020โ&client_id) however, I would like to format the number โ8โ in โ008โ. So far, I made it with ifs blocks (if client_id<10, if client_id<100, if client_id<1000โฆ) but I was wondering if there was a easier way of doing it.
Thank you very much,
Ryan
Solved! Go to Solution.
%3.1f
applied to 8
would give 8.0
. You appear to want the equivalent of %03u
, which would give 008
.
AppSheet doesnโt have a general-purpose formatting function. The TEXT() function does some formatting, but probably isnโt what you want. For your need, I suggest the following:
CONCATENATE(
[client_code],
"-",
RIGHT(("000" & [client_id]), 3)
)
If you always want client_id formatted as a three-digit number with leading zeros, you can set the columnโs Numeric digits property to 3
.
See also:
%3.1f
applied to 8
would give 8.0
. You appear to want the equivalent of %03u
, which would give 008
.
AppSheet doesnโt have a general-purpose formatting function. The TEXT() function does some formatting, but probably isnโt what you want. For your need, I suggest the following:
CONCATENATE(
[client_code],
"-",
RIGHT(("000" & [client_id]), 3)
)
If you always want client_id formatted as a three-digit number with leading zeros, you can set the columnโs Numeric digits property to 3
.
See also:
Hello,
Your line RIGHT((โ000โ & [client_id]), 3) is very clever and works perfectly, thank you very much!
User | Count |
---|---|
35 | |
30 | |
30 | |
20 | |
18 |