[SOLVED] Colour Validation of a field in a grid on lookup

I have been trying to change the colour of a field based on value of a lookup. I am using 0 or 1 as the values.

I have a lookup with 0 or 1 as the field value, i then apply a lookup to give a label like below in a grid:

0 = No

1 = Yes

I am trying to make the value (0 = Red) text and value (1 = Green) text. I see negative values can be formatted but i cant format defined numbers or ranges based on the value.

Also i would like to be able to format dates in particular ranges too, as a visual marker for the users.

I think this would be good as visual markers for users, in this particular situation i have created a Inventory Loan database, where i would like Loans that have not been returned to have a marker/flag to highlight those items.

Many Thanks

Hi,
you might have a look at those macros.

here: http://www.scriptcase.net/docs/en_us/scriptcase-macros/scriptcase-macros#sc_field_color

and here: http://www.scriptcase.net/docs/en_us/scriptcase-macros/scriptcase-macros#sc_field_style

jsb

Thank you very much, didn’t realise this could be done with macro’s.

Much appreciated!

where do you put the macro code? under EVENTS?

Hi There

I needed to make this validation in a grid, i put the code in onRecord Event.

The code is used is below and works, thanks to @jsbinca for pointing me in the right direction of macros.

if ({Column 1} == '1')
	{
sc_field_style({Column 1}, '#FF0000', '15px', '#FFFFFF', 'Arial, sans-serif', 'bold');
		}
else
	{
sc_field_style({Column 1}, '#00FF00', '15px', '#FFFFFF', 'Arial, sans-serif', 'bold');
		}
if ({Column 2} == '1')
	{
sc_field_style({Column 2}, '#FF0000', '15px', '#FFFFFF', 'Arial, sans-serif', 'bold');
		}
else
	{
sc_field_style({Column 2}, '#00FF00', '15px', '#FFFFFF', 'Arial, sans-serif', 'bold');
		}