Forum Discussion

MikeMcCartney's avatar
MikeMcCartney
Qrew Member
4 years ago

Combine Fields

I want to combine 2 fields for a drop down menu choice. One is a 4 digit numeric field (i.e. 2020).  The other is a Numeric Currency field (i.e. $100,000,000)  How do I combine them? 

Would like to have it display something like:  2020 Year:  $100,000,000

------------------------------
Mike McCartney
------------------------------

4 Replies

  • try this


    var number Value = Round([Currency]);

    var text Thousands = If(Abs($Value)>=1000,ToText(Int(Abs($Value)/1000)));
    var text Hundreds=Right(ToText(Int($Value)),3);
    var text Millions = If($Value>=1000000,ToText(Int($Value/1000000)));

    var text Numbers
    If($value>=1000000,"$" & ToFormattedText($value, "comma_dot"),
    If($Value=0,"$0.00",
    If($Value<0, "- ")
    &
    "$" & List(",",$Millions,$Thousands,$Hundreds)));

    ToText([year]) & " YEAR: " & $Numbers




    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • MikeMcCartney's avatar
      MikeMcCartney
      Qrew Member
      Got an error on Line 8 for:  If($value>=1000000,"$" & ToFormattedText($value, "comma_dot"),
      Error>>"IF" cannot be used as part of a variable name

      ------------------------------
      Mike McCartney
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        I think I was missing an = sign

        this one is tested

        var number Value = Round([Currency]);

        var text Thousands = If(Abs($Value)>=1000,ToText(Int(Abs($Value)/1000)));
        var text Hundreds=Right(ToText(Int($Value)),3);
        var text Millions = If($Value>=1000000,ToText(Int($Value/1000000)));


        var text Numbers =
        If($value>=1000000,"$" & ToFormattedText($value, "comma_dot"),
        If($Value=0,"$0.00",
        If($Value<0, "- ")
        &
        "$" & List(",",$Millions,$Thousands,$Hundreds)));

        ToText([YEAR]) & " YEAR: " & $Numbers

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------