Forum Discussion
RobertScalise
8 years agoQrew Cadet
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)