Changing grid colors dynamically

Is it possible to change grid data colors dynamically. For example if the DATE() is older than today’s date, or if the value is larger then another value I want to display a record in RED… (or better yet just a certain column)

Any examples or tips ?

ARTHUR

Pretty simple to do. IN the onrecord eventy you test the criteria and then use a macro to change the color:

sc_field_style({My_Field}, “Background-Color”, “Size”, “Color”, “Family”, “Weight”) [TABLE=“class: macros_desc_table”]
[TR]
[TD] This macro allows to modify the grid field style dinamically.
[TABLE=“border: 0, width: 100%”]
[TR]
[TD=“class: corpo1, align: left”]Parameter[/TD]
[TD=“class: corpo1, align: left”]Description[/TD]
[/TR]
[TR]
[TD=“class: corpo1, align: left”]Field[/TD]
[TD=“class: corpo1, align: left”]Name[/TD]
[/TR]
[TR]
[TD=“class: corpo1, align: left”]Background-Color (optional)[/TD]
[TD=“class: corpo1, align: left”]Field cell background Color[/TD]
[/TR]
[TR]
[TD=“class: corpo1, align: left”]Size (optional)[/TD]
[TD=“class: corpo1, align: left”]Field font size[/TD]
[/TR]
[TR]
[TD=“class: corpo1, align: left”]Color (optional)[/TD]
[TD=“class: corpo1, align: left”]Font Color[/TD]
[/TR]
[TR]
[TD=“class: corpo1, align: left”]Family (optional)[/TD]
[TD=“class: corpo1, align: left”]Font family[/TD]
[/TR]
[TR]
[TD=“class: corpo1, align: left”]Weight (optional)[/TD]
[TD=“class: corpo1, align: left”]Font weight[/TD]
[/TR]
[/TABLE]

		[B]Ex. 1:[/B]
		sc_field_style({my_field}, '#33FF99', '15px', '#000000', 'Arial, sans-serif', 'bold');
		[/TD]
	[/TR]
 [/TABLE]
[B]Macro Scope[/B]

[TABLE=“class: macros_desc_scope_table, cellpadding: 0, cellspacing: 0”]
[TR]
[TD]Grid application[/TD]
[/TR]
[TR]
[TD=“width: 120px, bgcolor: #f7f4f4”]onRecord[/TD]
[/TR]
[/TABLE]

If you’re looking for something similar to the calculation of the payment date.
So whether it is paid on time, early or later, and what is the difference in days, then maybe I can help you for example:

I tried to attach a picture, but unfortunately I can not - error (Image resize failed due to your image library not HAVING support for this image type. date.png)

/**

  • Checking the difference between due date to current date.
    */
    $placano = {datum_placila};

{razlika} = sc_date_dif({datum_zapadlosti}, ‘aaaa-mm-dd’, $placano, ‘aaaa-mm-dd’);
if({razlika} > 0)
{
sc_field_color (“datum_placila”, “#33FF66”);
sc_field_color (“razlika”, “#33FF66”);
//if amount is bigger then 0, means that current date is bigger then {razlika}
}
elseif({razlika} == 0)
{
sc_field_color (“datum_placila”, “#1222f1”);
sc_field_color (“razlika”, “#1222f1”);
//if amount is 0, means that current date igual {razlika}
}
elseif({razlika} < 0)
{
sc_field_color (“datum_placila”, “#f9071e”);
sc_field_color (“razlika”, “#f9071e”);
//if amount is less then 0, means that {razlika} is bigger then the current date
}

Regards
Rik

ok, thanks a lot, this helps.
BTW. looking at the code: what is the difference between Var1 = Var2 and Var1 == Var2 ?

To be honest I do not know. I’m not a programmer. Just a hobby programmer with no experience.

But only one “=” does not work

Would you submitted a picture of the result, however, it is not working.
Perhaps the * .txt result:

Invoice date Date of payment Paid Difference

14.01.2014 14.01.2014 14.01.2014 0
14.01.2014 29.01.2014 27.01.2014 2
20.12.2013 04.01.2014 07.01.2014 -3
20.12.2013 04.01.2014 07.01.2014 -3
20.12.2013 04.01.2014 03.01.2014 1
14.12.2013 29.12.2013 10.01.2014 -12
28.11.2013 13.12.2013 16.12.2013 -3
22.11.2013 07.12.2013 06.12.2013 1
22.11.2013 07.12.2013 16.12.2013 -9
21.11.2013 21.11.2013 21.11.2013 0

Well ‘=’ doesn’t work because in php the symbol is used as an assignment. For comparisson == needs to be used (is equal).

OK, now you tell me how to change colors in Editable_Grid_View.
SC macro is working in grid but generates errors in GridView !

Fatal error: Call to undefined function sc_field_style() in C:\Program Files\NetMake\v8\wwwr…

ARTHUR

A grid-view is not a grid but a form therefore the macro doesn’t work. I haven’t been playing with colours in grid view so I can’t tell.

OK, so we need to ask NET MAKE to enhance this MACRO to work in forms as well

Still don’t see why you need colors for that. If you had googled this forum you would have found out that this request has been done several times. I’m just a moderator and trying to help people out. I quit this for you if this continues.

I’ve searched many places and can’t find a solution. I need when consulting a form of multiple records change color according to the value of some fields to highlight them.

what code are you using now ?