styled
i have this:
if NetTotal < 0 then
"debt"
else
if NetTotal > 0 then "credit"
else
"balance"
end
end
i want when there is debt color be red and credit be yellow and balance be green. how can do styled for it?
9 replies
-
suggestion: use styled eg -> styled(displayText, displayBackground, displayColor, displayIcon)
then control the "displayColor" in the corresponding part of the "if statement" (or use a case do ) eg
if NetTotal < 0 then displayText := "debt"; displayColor := "red"; displayIcon := "warn" ... etc etc
You can also use #xxxxxx codes for the color you want
-
Try this:
styled(text('Net Total'), if 'Net Total' < 0 then
"red"
else
if 'Net Total' > 0 then "yellow" else "green" end
end, "")*Note that the result will be text.
-
thank you Nick but for example i want show me in formula : Debt or credit or balance with color. you furmula show color but show with result text.
-
see my suggestion above where you set the text, the background etc...
-
dear Luis, i dont underestand exactly your suggestion. can you do for me with furmula. how can write furmula for it. thank you.
-
Hi ,
here is the code with *all* possibilities... eg Background etc... you can simplify what you dont want
let displayText := "balance";
let displayIcon := "OK";
let displayColor := "green";
let displayBackground := "#EEEEEE";
if NetTotal < 0 then
displayText := "debt";
displayIcon := "warn2";
displayBackground := "#f0ead6";
displayColor := "red"
else
if NetTotal > 0 then
displayText := "credit";
displayIcon := "money";
displayBackground := "#4d9ad4";
displayColor := "yellow"
end
end;
styled(displayText, displayBackground, displayColor, displayIcon)
-
put this on a "formula" field and it will be formated as below
-
or if you simply want as in this screen shot, just cut the icon part and let eg the background color be exactly the form color... in my case it is the "#EEEEEE" (code also below)
let displayText := "balance";
let displayColor := "green";
let displayBackground := "#EEEEEE";
if NetTotal < 0 then
displayText := "debt";
displayColor := "red"
else
if NetTotal > 0 then
displayText := "credit";
displayColor := "blue"
end
end;
styled(displayText, displayBackground, displayColor, "") -
Great!
formula replied. Many thank you Luis
Content aside
- 5 yrs agoLast active
- 9Replies
- 4578Views