Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Array of array

galexis
2021-05-27
2021-05-28
  • galexis

    galexis - 2021-05-27

    HI,
    On webvisu, I would like to make a frame to display a table.
    On variable input /output I have an array of array of BOOL. 48 lines of 30 column wich contain BOOL.
    I want display only 1 column shoes with variable

    GVL:

    VAR
    MyArray : ARRAY [1..48] OF ARRAY [1..30] OF BOOL;
    ColumnToEdit: INT;
    END_VAR
    

    Frame:

    VAR_IN_OUT
        MyColumn: array [1..48] OF BOOL;
    END_VAR
    

    In the table on the frame, I call variable MyColumn.

    How to call only column X ?

    GVL.MyArray[ColumnToEdit] 
    

    This refernce create an error.

    For array of array, what is the structure for call ? MyArray[column, line] ? MyArray[line, column] ?

    Sorry for my bad english....
    Thank you very much for your help.

     

    Last edit: galexis 2021-05-27
  • m.prestel

    m.prestel - 2021-05-27

    Hey,

    I think there a few issues.
    Both your declarations in the GVL and Frame are missing 'Array'
    The array size of your frame declaration does not match the size declared in the GVL (30 vs 48)
    * The initial value of ColumnToEdit should be at least 1 to not access invalid data

    Best regards,
    Marcel

     
  • galexis

    galexis - 2021-05-27

    I forget ARRAY when I write the post, because it's not a copy/paste from the project. In my project it's ok.

     
  • galexis

    galexis - 2021-05-27

    I want introduce in frame only 1 column, because I don't want to configure all column of array of array.

     
  • m.prestel

    m.prestel - 2021-05-27

    This works for me. If you have any other issues, please attach your project.

     

    Last edit: m.prestel 2021-05-27
  • galexis

    galexis - 2021-05-28

    Ok it work.
    I have inverse [1..30] et [1..48] in my project.
    Thank you very much !

     

Log in to post a comment.