question

samuel.p avatar image
3 Likes"
samuel.p asked samuel.p commented

Dot Syntax replacement for settablenum/str

First of all I love the new dot syntax and arrays that you've added with the new parser. I do think that more documentation regarding both should have been added to the user manual before the official release though. I was using the old array types in a couple of my models. The error threw me for a bit of a loop after upgrading the model file.

Just had a quick question in regards to setting a table's cell value using the new dot syntax.

What I've come up with is:

  1. int tempValue = 3;
  2. Table outputTable = reftable("tableName");
  3. outputTable.cell(row, col).value = tempValue;

This seems to work but I wanted to double check if this is correct. If so I was assuming that setting it up this way would work as well but it doesn't:

  1. int tempValue = 3;
  2. reftable("tableName").cell(row, col).value = tempValue;

I'm assuming that reftable is returning a treenode type and not the new Table type. This leads me to believe that there may be another way?

FlexSim 17.0.0
flexscripttabledot syntax17.0.0
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Regan Blackett avatar image
6 Likes"
Regan Blackett answered samuel.p commented

You can use bracket notation with the tables, and basically treat them like arrays like this:

  1. outputTable[row][column] = tempValue;

This approach is also pretty smart in that it assigns the right data type depending if tempValue is a number or a string.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.