Discussions

Expand all | Collapse all

Add decimals to the right of a text field

  • 1.  Add decimals to the right of a text field

    Posted 01-23-2020 15:36
    I have a formula converting numbers to a list of text. I need it to display a list of amounts vertically. Everything is working properly including the "$" out front. The last thing I am needing to place is ".00" at the end of each of these fields to show the decimal places. 

    "<span style=\"font-size:11px;\">" &
    "<b>" &
    "<span style=\"text-decoration:underline;\">" &
    "<p style=\"text-align: Right;\">" &


    var text VerticalList =
    (List
    (" <br />",
    ToText([Cost Notes]),
    ToText([Note 2 Cost]),
    ToText([Note 3 Cost]),
    ToText([Note 4 Cost])));

    If($VerticalList <> "",
    "$"
    & $VerticalList)


    &"</p>"
    & "</span>"
    & "</b>"
    & "</span>"

    ------------------------------
    Mike Klausing
    ------------------------------


  • 2.  RE: Add decimals to the right of a text field

    Posted 01-24-2020 15:23
    Hi Mike, I tried your formula in a Rich Text field. All you need to update is this:

    ToText([Cost Notes]) &".00",
    ToText([Note 2 Cost]) &".00",
    ToText([Note 3 Cost]) &".00",
    ToText([Note 4 Cost]) &".00"));


    ------------------------------
    Lisa Sell
    ------------------------------



  • 3.  RE: Add decimals to the right of a text field

    Posted 01-24-2020 15:25
    Lisa, 

    Thank you for your response. I forgot to clarify in my original question that any or all of these fields may be blank. So if they are null then the ".00" will still show up and I need that to only show up if there is a value in that particular field.

    ------------------------------
    Mike Klausing
    ------------------------------



  • 4.  RE: Add decimals to the right of a text field

    Posted 01-24-2020 16:00
    This works on my test report. I'm sure there are better ways to do this, but here is my update:
    "<span style=\"font-size:11px;\">" &
    "<b>" &
    "<span style=\"text-decoration:underline;\">" &
    "<p style=\"text-align: Right;\">" &

    var text costnote =ToText([Cost Notes])&".00";
    var text notetwo =ToText([Note 2 Cost])&".00";
    var text notethree =ToText([Note 2 Cost])&".00";
    var text notefour =ToText([Note 2 Cost])&".00";

    var text VerticalList =
    (List
    (" <br />",
    $costnote,
    $notetwo,
    $notethree,
    $notefour
    ));

    If([Cost Notes]>0,

    //$VerticalList <> "",
    "$"
    & $VerticalList)


    &"</p>"
    & "</span>"
    & "</b>"
    & "</span>"

    ------------------------------
    Lisa Sell
    ------------------------------



  • 5.  RE: Add decimals to the right of a text field

    Posted 01-24-2020 16:32
    Lisa, 

    Thank you that worked great! 

    In case anybody needs to see the working formula I ended up using its below. I changed the variables to be if statements so they will collapse if null, also put a "$" after the break. 

    "<span style=\"font-size:11px;\">" &
    "<b>" &
    "<span style=\"text-decoration:underline;\">" &
    "<p style=\"text-align: Right;\">" &
    var text costnote =If([Cost Notes]>0,ToText([Cost Notes])&".00",null);
    var text notetwo = If([Note 2 Cost]>0, ToText([Note 2 Cost])&".00", null);
    var text notethree =If([Note 3 Cost]>0,ToText([Note 3 Cost])&".00",null);
    var text notefour =If([Note 4 Cost]>0,ToText([Note 4 Cost])&".00",null);
    var text VerticalList =
    (List
    (" <br />$",
    $costnote,
    $notetwo,
    $notethree,
    $notefour
    ));
    If([Cost Notes]<0, null,
    If($VerticalList <> "",
    "$"
    & $VerticalList))

    &"</p>"
    & "</span>"
    & "</b>"
    & "</span>"


    ------------------------------
    Mike Klausing
    ------------------------------