Forum Discussion

JulieMeeker's avatar
JulieMeeker
Qrew Trainee
3 years ago

Convert a number to text

I need to pad a number with 2 leading zeros to be able to read a legacy bar code.  The ToFormattedText function does not actually convert the number so I can't use the PadLeft function.  I know there has to be a way to convert a number to text, but I can not seem to find the right function.  Any help would be appreciated.

------------------------------
Julie Meeker
------------------------------

8 Replies

  • How about this as a formula text field.

    var text MyBarCode = ToText([my bar code field]); 
    IF(not begins($MyBarCode, "00"), "00" & $MyBarCode, $MyBarCode)




    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • JulieMeeker's avatar
      JulieMeeker
      Qrew Trainee
      Can you explain a little more please.  I am not finding a var text  or not begins function in the list.  what does $ represent?

      ------------------------------
      Julie Meeker
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        I'm all about super tidy and readable formuals since in all probability I will be the one who needs to look back at a formula I did years ago to see what it is doing, or if its someone else, the the formulas should be stupid simple to read.

        So I like to use Formula Variables.  here is some help on them.
        https://help.quickbase.com/user-assistance/formula_variables.html

        Maybe in this case it was overkill.

        You can also just do this

         
        IF(not begins([My bar code field], "00"), "00" & [My bar code field], [My bar code field])





        ------------------------------
        Mark Shnier (YQC)
        mark.shnier@gmail.com
        ------------------------------