On record event - Parse error

Hi ,
I need a small help. I can’t find the error in my code.

I use in the onRecord event the following code

$date_end = sc_date(date(“Y.m.d”), “yyyy-mm-dd”, “+”, 0, 1, 0);

$amount_days_1 = sc_date_dif($date_end, ‘yyyy-mm-dd’, {REZ_FF_FP_1}, ‘yyyy-mm-dd’);

// only for test --> sc_alert({REZ_FF_FP_1} . ‘-’ . $date_end . ‘-’ . $amount_days_1);

if($amount_days_1 < 30)
{

  • sc_field_style({REZ_FF_FP_1}, ‘#FF0000’, ‘12px’, ‘#FFFFFF’, ‘Arial, sans-serif’, ‘bold’);*

}

Now I got the following error message
Parse error: syntax error, unexpected ‘FF0000’ (T_STRING)

If I run only the the sc_field_style macro it is still working fine

Thanks in advance

Try to remove the * at the end of the line

1 Like

Hi,

thank you but it is not part of the code it was inserted via the forum tool
the original is

$date_end = sc_date(date(“Y.m.d”), “yyyy-mm-dd”, “+”, 0, 1, 0);

$amount_days_1 = sc_date_dif($date_end, ‘yyyy-mm-dd’, {REZ_FF_FP_1}, ‘yyyy-mm-dd’);

// only for test --> sc_alert({REZ_FF_FP_1} . ‘-’ . $date_end . ‘-’ . $amount_days_1);

if($amount_days_1 < 30)
{
sc_field_style({REZ_FF_FP_1}, ‘#FF0000’, ‘12px’, ‘#FFFFFF’, ‘Arial, sans-serif’, ‘bold’);
}

btw: the macro works correct in an other application

if({REZ_FF_FP_1} > {REZ_FF_bis})
{
sc_field_style({REZ_FF_FP_1}, ‘#FF0000’, ‘12px’, ‘#FFFFFF’, ‘Arial, sans-serif’, ‘bold’);
}

I got also the same error message if I use the macro

sc_field_color(“REZ_FF_FP_1”, “#FF0000”);

I don’t see what’s wrong, the error may be trailing from a previous line

Use this when you insert code in the forum
image

$date_end = sc_date(date("Y.m.d"), "yyyy-mm-dd", "+", 0, 1, 0);

$amount_days_1 = sc_date_dif($date_end, 'yyyy-mm-dd', {REZ_FF_FP_1}, 'yyyy-mm-dd');

// sc_alert({REZ_FF_FP_1} . '-' . $date_end . '-' . $amount_days_1);

if($amount_days_1 < 30)
{
  sc_field_style({REZ_FF_FP_1}, '#FF0000', '12px', '#FFFFFF', 'Arial, sans-serif', 'bold');
}

I tested it line by line and it seems that the combination of the
two first lines ($date_end… and $amaount_days…) with the line (sc_field_style…) is not working in this event