Convert numeric to text formatted with leading zero

I need to convert a numeric value (minutes) to a two-character text value with leading zero when the value is less than 10. The result is stored in a custom state.

Here’s what I have right now:


There is no option to specify a two-character result with leading zero(es). (If the value is zero, the text value should be 00.)

How is this kind of thing done in Bubble?

Since I couldn’t coax Bubble to allow me to append the the minutes value after a literal “0”, I did it in two steps followed by an optional step to set the value to “00” when minutes are zero.

  1. set the text element to “0”:
    image

  2. append the minutes value to the text element:
    image

  3. If the value is zero, set the text element to “00”:
    image

I did this late last night. Now, in the morning light, I believe the third step is extraneous. I’ll test that later but for now, at least the formatting is correct and I can get on with other work.

This topic was automatically closed after 70 days. New replies are no longer allowed.