If statement in 9.2

I am trying to use
if ({Scan_Glucosemg/dl} == 70) {
sc_field_color(“Scan_Glucosemg/dl”, “red”);
}
but I get the below error
Parse error: syntax error, unexpected ‘{’ in C:\Program Files\NetMake\v9\wwwroot\scriptcase\app\meter\grid_readings\index.php on line 660

It is a integer field.

I think the problem is variable name with slash.

I change it to Scan_Glucosemg.
Well the error went away but it didn’t change the color of Scan_Glucosemg

I got it to work with the following code:

if ({Scan_Glucosemg} < 70)
{
sc_field_color(Scan_Glucosemg, #FF0000);
} else {
sc_field_color(Scan_Glucosemg, #000000);
}

How do I mark this topic solved?

FYI - In a grid - onRecord event - I do field color like this:

if ({SIM} == 1)
{  
    // Simulation Data 
    {SIM} = "SIM";
    sc_field_style({SIM}, 'Orange', '15px', '#000000', 'Arial, sans-serif', 'bold');
}
else
{  
    {SIM} = "";
    sc_field_style({SIM}, 'White', '15px', '#000000', 'Arial, sans-serif', 'bold');
}

There is no formal way to mark these posts as far as I know. Can’t seem to edit the subject line :frowning:
But it is useful fro future users :slight_smile:
Peace,
Jamie

by chance dl is also used in php ----> dl () - Loads to PHP extension at runtime
whose result is a booleen

nsch2308, good observation!