Numeric fields automatically remove the 0 at the end of a numeral with a decimal place, so 1.10 will become 1.1 but I want it to stay as 1.10.
 110 Points
Posted 2 years ago
QuickBaseCoach App Dev./Training (Mark Shnier), Champion
 72,448 Points
 214 Points
Thanks for the tip. As I needed to display negative values in red, I went with the following approach. I just check how many characters are after the decimal after formatting, then I add back ad is needed.
var text txtRounded = ToFormattedText(Round([yourvalue]*100,0.01),"none_dot");
var number wheredot=If(Contains($txtRounded,"."),Length(Right($txtRounded,".")),0);
var text fmtnbr = If($wheredot = 0, $txtRounded & ".00", If($wheredot = 1, $txtRounded & "0", $txtRounded)) ;
If([yourvalue] < 0, "<span style='color: #EA3C53'>" & $fmtnbr & "</span>",$fmtnbr)
var text txtRounded = ToFormattedText(Round([yourvalue]*100,0.01),"none_dot");
var number wheredot=If(Contains($txtRounded,"."),Length(Right($txtRounded,".")),0);
var text fmtnbr = If($wheredot = 0, $txtRounded & ".00", If($wheredot = 1, $txtRounded & "0", $txtRounded)) ;
If([yourvalue] < 0, "<span style='color: #EA3C53'>" & $fmtnbr & "</span>",$fmtnbr)
 20 Points
How to format to one place decimal using code from Robert (above)?
Want to show 00.0%
Want to show 00.0%
(Edited)
Related Categories

Tables & fields
 7327 Conversations
 200 Followers
Joshua Hamilton
QuickBaseCoach App Dev./Training (Mark Shnier), Champion
James Holton
QuickBaseCoach App Dev./Training (Mark Shnier), Champion
so you will need to convert the number to text with a formula. I have a small collection of them, but here is one that should work from my notes.
Substitute in your field name where I have the field [currency field]
var number Value = Round([currency field],0.01);
var text Decimals = "." & Right(ToText(Int(Abs($value) * 100)),2);
var text Thousands = If(Abs($Value)>=1000,ToText(Int(Abs($Value)/1000)));
var text Hundreds=Right(ToText(Int(Abs($Value))),3);
If($Value=0,"$0.00",
IF($Value<0, "") & "$" & List(",",$Thousands,$Hundreds) & $Decimals)
Let me know how it goes and if I need to test the formula myself.
Ursula Ll
QuickBaseCoach App Dev./Training (Mark Shnier), Champion
var text Millions = If(Abs($Value)>=1000000,ToText(Int(Abs($Value)/1000000)));
and then
.....List(",",$Millions, $Thousands,$Hundreds) & $Decimals)
Ursula Ll