Announcement

Collapse
No announcement yet.

If statement in 9.2

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    I think the problem is variable name with slash.

    Comment


    • #3
      I change it to Scan_Glucosemg.
      Well the error went away but it didn't change the color of Scan_Glucosemg

      Comment


      • #4
        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);
        }

        Comment


        • #5
          How do I mark this topic solved?

          Comment


          • #6
            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
            But it is useful fro future users
            Peace,
            Jamie

            Comment


            • #7
              by chance dl is also used in php ----> dl () - Loads to PHP extension at runtime
              whose result is a booleen
              Last edited by nsch2308; 08-22-2018, 10:23 AM.

              Comment


              • #8
                nsch2308, good observation!

                Comment

                Working...
                X