Multiple Output Commands within if/else Errors

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by chromus, Jan 29, 2020.

  1. chromus

    chromus

    Joined:
    Jan 27, 2014
    Messages:
    147
    Likes Received:
    16
    Location:
    Perth
    Hi Gang,

    I'm trying to do add an extra command to an if/else statement in PICED and it keeps throwing errors

    Error C006 at line 268:8 - Illegal symbol
    Error C261 at line 268:25 - Tag Error

    2Capture.JPG

    The individual lines work fine, as I can // each out and the active line compiles fine.
    1Capture.JPG 3Capture.JPG

    What am I missing?

    I know I could code a whole extra module to do this but that's not efficient use of memory or time.

    @Ashley @bmerrick @Wonkey if you could give me a pointer that would be appreciated.

    Code:
    {Sets EDLT Indicator colour based on tank temp to indicate dangerous tank temps}
    
    //Code Tests every 3 mins
    //set to EDLT Page Key Indicator to Blue of tank <= 25C
    //set to EDLT Page Key Indicator to Red if tank >= 28C
    //set to EDLT Page Key Indicator to White if tank >25C or <28C
    
    once (Second = 17) then // IMPORTANT - don't run this code every cycle - once a minute is ample
        begin
        r_edtemp := GetRealIBSystemIO("Measurement App Real Value", 254, 1, 4);  
          
           if r_edtemp <= 25.0 then
           SetLightingLevel("EDLTTextColour", 30%, "0s")
    //       SetLightingState("Tank Warning", ON)
    
           else
           if r_edtemp >= 27.5 then
           SetLightingLevel("EDLTTextColour", 60%, "0s")
    //       SetLightingState("Tank Warning", ON)
          
           else
           SetLightingLevel("EDLTTextColour", 100%, "0s");
    //       SetLightingState("Tank Warning", Off);
      end;
    
     
    chromus, Jan 29, 2020
    #1
    1. Advertisements

  2. chromus

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,021
    Likes Received:
    80
    Location:
    Adelaide, Australia
    An IF takes a single statement (Actually everything in Pascal takes a single statement) , so you need to enclose the 2 statements in a BEGIN/END to make a compound statement:


    Code:
    {Sets EDLT Indicator colour based on tank temp to indicate dangerous tank temps}
    
    //Code Tests every 3 mins
    //set to EDLT Page Key Indicator to Blue of tank <= 25C
    //set to EDLT Page Key Indicator to Red if tank >= 28C
    //set to EDLT Page Key Indicator to White if tank >25C or <28C
    
    once (Second = 17) then // IMPORTANT - don't run this code every cycle - once a minute is ample
        begin
        r_edtemp := GetRealIBSystemIO("Measurement App Real Value", 254, 1, 4); 
          
           if r_edtemp <= 25.0 then
           begin      // <----- HERE
           SetLightingLevel("EDLTTextColour", 30%, "0s"); // <---- and semicolon after each statement
           SetLightingState("Tank Warning", ON);
           end // <----- and here
           else
           if r_edtemp >= 27.5 then
           begin // <---- and here
           SetLightingLevel("EDLTTextColour", 60%, "0s");
    /      SetLightingState("Tank Warning", ON);
           end // <--- and here
          
           else
         begin    /// <-- and here
           SetLightingLevel("EDLTTextColour", 100%, "0s");
           SetLightingState("Tank Warning", Off);
          end // <--- and here
      end;
     
    Ashley, Jan 29, 2020
    #2
    Mr Mark and chromus like this.
    1. Advertisements

  3. chromus

    chromus

    Joined:
    Jan 27, 2014
    Messages:
    147
    Likes Received:
    16
    Location:
    Perth
    Thanks @Ashley, I had found after much digging, an example suggesting exactly this.

    Now having confirmed the process by reading ur reply I’ve tested and it’s now working.

    I really appreciate u taking the time to reply.

    Phil
     
    chromus, Jan 29, 2020
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.