Using variables with the macro sc_field_style

Currently the macro sc_field_style doesn’t accept variables. It will be important to be able to pass variables as parameter, specifically the color

Ex. this code is currently not supported. sc_field_style({Column}, {Color});


I had the same problem but wanted to use anyhow a variable.
I found a workaround by using first sc_field_style and directly after a piece of generated code. (I think scriptcase should make it possibel as it is not a major change)

The workaround is :
$lightred = ‘#fe6267’;
sc_field_style({testfield}, ‘#fe6267’); // use any # code
$this->NM_field_style[“testfield”] = “background-color:” . $lightred. “;”; // this is fact a newly generated code , if scriptcase changes this it will not work anymore

This works only in onrecord of a grid


great bypass! thx

Strange. The code works just fine, but when i use this code in a grid with joined tables, the script doesn’t work for the field

$kleur_w = {hex_kleur_w};
sc_field_style({event_workshop.wk_werkvorm}, “#ED135D”,“14”, “#ecf0f1”, “”, “bold”);
$this->NM_field_style[“event_workshop.wk_werkvorm”] = “background-color:” . $kleur_w. “;”;

so wk_werkvorm just works fine in a grid

event_workshop.wk_werkvorm in another grid that’s joined just doesn’t work, same code other field.

any suggestions?

Found it! If you use joint fields.
you have to use and underscore instead of a .


NM_field_style[“event_workshop.wk_werkvorm”] = “background-color:” . $kleur_w. “;”;

should be

NM_field_style[“event_workshop_wk_werkvorm”] = “background-color:” . $kleur_w. “;”;