question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Axel Kohonen commented

Bug with clearglobaltable used after importtable?

Hi,

See the attached model and data.csv files. The model assumes that the data.csv files are in the same directory as the model. In the model file I have a global table and using the script window I call importtable to import the data from the .csv file and then try to clear the global table. It never seems to clear the whole table as it should. I tried to call clearglobaltable both with the table name as reference and reftable(tablename) as reference.

When I call clearglobaltable using the table name as reference it seems that cells in the first column are cleared up to the row amount that was previously used in the table. When I was looking at this it first only cleared the first cell of the table, but then when I imported the data2.csv file and then data1.csv again it seemed to clear the first four rows, which could indicate that the table remembers the size before importtables and uses that when clearing the table.

When I tried to call clearglobaltable using reftable(tablename) as reference it seems that all cells in the first column of the table are cleared, but not the whole table.

Importing the column headers seems to affect if the first row is cleared or not in some way.

Is this a bug with importtable or clearglobaltable?

Also, as another note. If I have the global table view open when I run the script then the Rows field in the Quick properties window does not update visibly (from 4 to 5 in this case when changing the data file to import). However, if I close the table view and reopen it, then the row amount has updated to the correct size of the imported table. I guess this is just that the quick properties window is not updated when the table view is open.

20161021-clearglobaltablenotworkingwithimportgloba.zip

Thank you!

Kind regards,

Axel

FlexSim 16.2.1
global tableimporttable.csvclearglobaltable
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

·
Phil BoBo avatar image
1 Like"
Phil BoBo answered Axel Kohonen commented

"When I tried to call clearglobaltable using reftable(tablename) as reference it seems that all cells in the first column of the table are cleared, but not the whole table."

I can't replicate this. When you call clearglobaltable() using reftable(), it seems to work fine. clearglobaltable() sets string cells to a blank string and number cells to zero. Perhaps that's why you think it isn't clearing certain cells?

It appears that clearglobaltable() also has the same issue as gettablecols() did, where the overloads that take numbers or strings are using the global table's rows and columns variables instead of the actual number of rows and columns in the table. I'll add a note to the dev list.

clearglobaltable() using reftable() seems to be working correctly though.

· 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.

Axel Kohonen avatar image Axel Kohonen commented ·

Hi @phil.bobo

Thank you! You are right. The values are cleared correctly except for the last row. I was confused since the first row contains strings, but rows 2-4 in column 2 are numbers. I also got confused due to the fact that the last row was not cleared when calling clearglobaltable with the table name and when switching from the data with 4 rows to the data with 5 rows, but that must be the issue with the overloads that you describe.

Thank you!

Axel

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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