Forum Discussion
Hi, Ryan!
Thanks for your reply.
I tried it as you suggested - I didn't know about the variables and that makes it so easy! - but on the third line of the IF statement, I get "Expecting number but found text".
I've tried it the hard way:
If(
Round(([Count]/[Number Held])*100,0.01) > 10,
"<div style=background-color:Black>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>",
Round(([Count]/[Number Held])*100,0.01) > 2,
"<div style=background-color:Red>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>",
Round(([Count]/[Number Held])*100,0.01) > 0,
"<div style=background-color:Yellow>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>",
Round(([Count]/[Number Held])*100,0.01) <= 0,
"<div style=background-color:LightGreen>" & ToText(Round(([Count]/[Number Held])*100,0.01)) & "%" & "</div>",
ToText(Round(([Count]/[Number Held])*100,0.01)))
And the easy way:
var number value = Round(([Count]/[Number Held])*100,0.01);
var text display = $value & "%";
If(
$value > 10,
"<div style=background-color:Black>" & $display & "</div>",
$value > 2,
"<div style=background-color:Red>" & $display & "</div>",
$value > 0,
"<div style=background-color:Yellow>" & $display & "</div>",
$value <= 0,
"<div style=background-color:LightGreen>" & $display & "</div>",
$display
)
No joy. :-(
------------------------------
Patricia Malarkey
------------------------------
Hmmm, can you verify that both Count
and Number Held
are numeric fields? It worked on my side when both are set as numeric fields so I'm not sure what else would be causing the error you're seeing.
------------------------------
Ryan Pflederer
------------------------------
Related Content
- 2 years ago
- 2 years ago
- 7 days ago
- 10 months ago