Discussions

formula text - floating decimal places

  • 1.  formula text - floating decimal places

    Posted 10-23-2018 12:52
    Currently converting a numeric field to a text field, but i need to be able to display the decimal places properly. Sometimes there are 3 or 4.. Thinking an If statement will take care of it, nut not sure where to start with the conversion.

    Currently using the below. 
    -----
    var number Value = Round([Rate 1],0.01);
    var text Decimals = "." & Right(ToText(Int($value * 100)),2);
    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)));


    If($value>=1000000,"$" & ToFormattedText($value, "comma_dot") & $decimals,
    //If($value>=1000000,"$" & ToFormattedText($value, "comma_dot"),
    If($Value=0,"$0.00",
    If($Value<0, "- ")
    &
    "$" & List(",",$Millions,$Thousands,$Hundreds) & $Decimals))
    //"$" & List(",",$Millions,$Thousands,$Hundreds)))
    ------