How to set a values in two dimensional array

Hi! I am quite stuck. Seems like a basic thing in all languages, but I can’t find a way to initiate 2D array in Robot.
What I need to do. I have a 2x3 web table.

1 2
3 4
6 7

I need to create a 2D array from it.
What I’ve got:

    FOR    ${row_num}    IN RANGE    1   ${rows+1}
            ${row_num}    Evaluate    ${row_num}+${1}  #2 index is a first row in table
            FOR    ${column_num}    IN RANGE     1   ${columns+1}
                 ${CellItem}   Get Table Cell  xpath=//table[@class='mat-table cdk-table classifier-table']   ${row_num}  ${column_num}                  
                 ${tableitems}[${row_num}][${column_num}]    Evaluate    ${CellItem} - THIS is the place I stuck. Can't find anythig that can help.
            END
    END

Thanks for ideas in advance.

A nice test data table would help us to help you. You could have created a HTML block with simulated data. The array you show skips number 5, but in your code you seem to obtain only one element at the time.

Here is one possible pseudo code:

tableitems = List()
max_rows = 3
max_col = 2
row = 1
While row <= max_rows
    row_item = List()
    col = 1
    While col <= max_col
        cell_item = GetTableCell("locator",row, col)
        row_item.Append(cell_item)
        col = col + 1
     End_While
     tableitems.Append(row_item)
     row = row + 1
End_While

# Verification
For row, item IN ENUMERATE tableitems
      Print(row, item)
End_For

(of course you can use FOR loops as you did)
You need to import the Collections library.

1 Like

Thank you! I will try to adapt your solution.