Results 1 to 3 of 3
  1. #1
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    60
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    help with local variables

    Hi,
    I can use some help with local variables.
    I do want to use a button to encrease variables.
    like 0 + 1 = 1 and when push the button again 1 + 1 = 2 ect. Buth mine remains 1 what ever i do.
    It should be simple a guess?
    hope some one can help me out?
    regards,
    henri

  2. #2
    75+ Posting Member
    Join Date
    Apr 2009
    Location
    Toronto
    Posts
    125
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: help with local variables

    Hello Henri.

    Assuming this is about SIOC:

    When an event occurs to cause a section of script to be executed, a set of local variables is created for use during that iteration of the script. The local variables are lost when the section of script ends; i.e values assigned to them do not survive from one iteration to the next.

    For your purposes use an ordinary variable; e.g.

    Code:
    Var 0010, NAME Button, LINK IOCARD_SW, TYPE P
    {
       &Counter = &Counter + 1
       .
       .  etc.
       .
    }
    
    Var 0020, NAME Counter, VALUE 0
    Jim.

  3. #3
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    60
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: help with local variables

    Thanks Jim,
    that did it.
    regards,
    henri