0

Background Color

I ahve a field (function) in which the following code is set:

 

if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
styled("Gewinn", "green", "", "")
else
if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' >= 'aktueller Kurs' * Anzahl then
styled(text("Verlust"), "#ffa500", "black", "")
end
end

 

Whatever I do, 

the result is never what I wanted:

I want:

If positive, then

 

a) Background Color green

b) Text in white

c) Symbol arrow-n

 

if not

 

a) Background Color red

b) Text in white

c) Symbol arrow-S

7 replies

null
    • awegener
    • 3 yrs ago
    • Reported - view

    What puzzles me is the fact that the code is well working with other fields, but not in this case...

    • Nick
    • 3 yrs ago
    • Reported - view

    Here you go

     

    if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
    styled("Gewinn", "green", "white", "arrow-n")
    else
    if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' >= 'aktueller Kurs' * Anzahl then
    styled(text("Verlust"), "red", "white", "arrow-s")
    end
    end

    • awegener
    • 3 yrs ago
    • Reported - view

    Thank you, but this does not help. What I get is a white field with a white text and an icon. 

     

    if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
    styled("Gewinn", "green", "white", "arrow-n")
    else
    if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' >= 'aktueller Kurs' * Anzahl then
    styled(text("Verlust"), "red", "white", "arrow-s")
    end
    end

     

    What could be the problem?

     

    Thank you

    • awegener
    • 3 yrs ago
    • Reported - view

    Or simplified:

     

    if 'investiertes Kapital abzüglich Ausschüttungen und Steuererstattungen' < 'aktueller Kurs' * Anzahl then
    styled(text("Gewinn"), "green", "", "arrow-n")
    else
    styled(text("Verlust"), "red", "red", "arrow-s")
    end

     

    I wonder why in this constellation I cannot change the background color of the cell. It is just not shown.

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

    Maybe because the formula field is styled in the settings of that field...(where you can chose also the style of the border etc.)

    • Nick
    • 3 yrs ago
    • Reported - view
    • awegener
    • 3 yrs ago
    • Reported - view

    Thank you, Nick. The problem was that the setting of the field itself overrule. as Steven indicated. Although I just centered the cell, it seems that even this results in overruling color settings. Thank you, problem solved.

Content aside

  • 3 yrs agoLast active
  • 7Replies
  • 704Views