Populate Array using the FOR instruction

dsanow92
2021-04-13
2021-04-14
  • dsanow92

    dsanow92 - 2021-04-13

    I am trying to populate a large number of variables that looks like this.

    GVL.HMITags.MasterPortStatus[1]:= MasterStatusPort1;
    GVL.HMITags.MasterPortStatus[2]:= MasterStatusPort2;
    GVL.HMITags.MasterPortStatus[3]:= MasterStatusPort3;
    GVL.HMITags.MasterPortStatus[4]:= MasterStatusPort4;
    GVL.HMITags.MasterPortStatus[5]:= MasterStatusPort5;
    GVL.HMITags.MasterPortStatus[6]:= MasterStatusPort6;
    GVL.HMITags.MasterPortStatus[7]:= MasterStatusPort7;
    GVL.HMITags.MasterPortStatus[8]:= MasterStatusPort8;

    I'm looking to simplyfy my code by using the FOR loop but how do I change the MasterStatusPortX
    It should look something like what I have below but how do I attach that last tag using the "i" variable also

    FOR i := 1 TO 8 DO
    GVL.HMITags.MasterPortStatus[i]:= MasterStatusPort??
    END FOR

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3
    Talk.ru: 5
    Talk.ru: 7
    Talk.ru: 8

  • dumpfbacke

    dumpfbacke - 2021-04-14

    in my opinion you have to make array of "MasterStatusPort" too.

    FOR i := 1 TO 8 DO
    GVL.HMITags.MasterPortStatus[i]:= MasterStatusPort[i]
    END FOR

     

Log in to post a comment.