0

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

null
    • Luis
    • 5 yrs ago
    • Reported - view

    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

    • Nick
    • 5 yrs ago
    • Reported - view

    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.

    • New_Sun
    • 5 yrs ago
    • Reported - view

    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. 

    • Luis
    • 5 yrs ago
    • Reported - view

    see my suggestion above where you set the text, the background etc...

    • New_Sun
    • 5 yrs ago
    • Reported - view

    dear Luis, i dont underestand exactly your suggestion. can you do for me with furmula. how can write furmula for it. thank you.

    • Luis
    • 5 yrs ago
    • Reported - view

    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)

    • Luis
    • 5 yrs ago
    • Reported - view

    put this on a  "formula" field and it will be formated as below

    Screenshot 2019-08-10 at 10.04.06 Screenshot 2019-08-10 at 10.04.14 Screenshot 2019-08-10 at 10.04.23

    • Luis
    • 5 yrs ago
    • Reported - view

    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)

    Screenshot 2019-08-10 at 10.14.42 Screenshot 2019-08-10 at 10.14.37 Screenshot 2019-08-10 at 10.14.31

    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, "")

    • New_Sun
    • 5 yrs ago
    • Reported - view

    Great!

    formula replied. Many thank you Luis 

Content aside

  • 5 yrs agoLast active
  • 9Replies
  • 4578Views