Is it possible to format a number ("%3.1f" C style) in a auto-compute formula?

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,


%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:

  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:



Your line RIGHT((“000” & [client_id]), 3) is very clever and works perfectly, thank you very much!