How to put an array of values into a row or column of a table?

How to put an array of values into a row or column of a table?

jouky_d
Not applicable
113 Views
5 Replies
Message 1 of 6

How to put an array of values into a row or column of a table?

jouky_d
Not applicable

[ FlexSim 23.2.1 ]

Hello everyone,

I need to put an array of values into a row and other into a column of a table. One way to do it is using a for loop entering value per value, however I don't know if this is the optimal way. Maybe there is a command for that as:
table[Row2]

  • = MyArray;
  • table

  • [Col3] = MyArray;

    Is there an optimal option than a for loop?
  • 0 Likes
    Accepted solutions (1)
    114 Views
    5 Replies
    Replies (5)
    Message 2 of 6

    jouky_d
    Not applicable
    In addition, the array has lots of zeros.
    0 Likes
    Message 3 of 6

    joerg_vogel_HsH
    Mentor
    Mentor

    array-in-table-cell.jpg

    you can change table cell datatype:

    aggregate table row or column to array

    aggregate-table-col-row-to-array.jpg

    Aggregate_table_col_row_to_array.fsm


    0 Likes
    Message 4 of 6

    jason_lightfootVL7B4
    Autodesk
    Autodesk
    Accepted solution

    Assuming you want one value per table cell there is currently no predefined method for this - a loop is your best bet, but you can write a user command to do this quite easily and then reuse it (passing the array as a variant and the table and range you want to apply it to).

    You could also suggest an idea on this site that adding or updating a row based on a set of array values would be useful - I'm less sure about the column application and how that might work with, for example, sql.

    0 Likes
    Message 5 of 6

    jouky_d
    Not applicable
    I did it using a for loop. This can be useful with sparse matrix to only take the row, column and value only, and not the zeros. Thank you.
    0 Likes
    Message 6 of 6

    jouky_d
    Not applicable
    Thank you for your answer. However, I needed to join the array into the table. Using a for loop is find (I didn't know if there is other optimal commands for that). Thank you!
    0 Likes