Conditional Background color in grid

Hello Everyone,

I have a grid with a field status. From it I want to format row color to red (ex) depend on status value. If 2 = red and if 1 = normal (no format)
How to do that.

The only way is to go to the onrecord event and do the checking there. Then you are able to set the background of each field using the sc_ macro’s. Here you can set foreground colour, background color and a lot of other properties. Unfortunately you cannot change the full row in a different colour at once. Would be a nice feature though.

I hope the next version can handle this

Hi,

the first time it wordked but with this code it does not work , my B! field is numeric.

if ({B1} > 0 ) {
sc_field_color(“B1”,"#57821E");

}

Thanks in advance

Erwin

N.B. Is there also a way to chnage the backgroud color of that one field?

[QUOTE=etsoft;38793]Hi,

the first time it wordked but with this code it does not work , my B! field is numeric.

if ({B1} > 0 ) {
sc_field_color(“B1”,"#57821E");

}

Thanks in advance

Erwin

N.B. Is there also a way to chnage the backgroud color of that one field?[/QUOTE]

Use this way:

if ({estado_documento}=='N'){
	sc_field_style({estado_documento}, 'red', '', '', '', '');
} else if ({estado_documento}=='P') {
	sc_field_style({estado_documento}, 'olive', '', '', '', '');
} else if ({estado_documento}=='S') {
	sc_field_style({estado_documento}, 'green', '', '', '', '');
}

Reference: sc_field_style({My_Field}, “Background-Color”, “Size”, “Color”, “Family”, “Weight”)