article

Paul Toone avatar image
0 Likes"
Paul Toone posted

Global Tables   

Global Tables are accessed from the Toolbox. (View menu > Toolbox > Add > Global Table).

Global Tables can store numerical or string data. This data can be accessed by any object in the model using the various table commands. A model may have any number of Global Tables.

Editing the Table

To edit a cell in the table, click the desired cell and begin typing to overwrite all data in the cell, or double click on the cell to select the cell's contents. Use the arrow keys to navigate between cells. Cells hold number data by default, but can be set to hold string data by right-clicking on the cell and selecting Assign String Data. The right-click menu also has opens for insert/deleting rows and columns, clearing cell data, and sorting by column.

Name Combobox - This is the table's name and has a list of all of the model's Global Tables. The name should be memorable and describe the table's function. The commands to read and write to them access them by name. You can view other Global Tables in this window by clicking the dropdown arrow next to the name.

- Adds a Global Table to your model.

- Removes the current Global Table from your model.

- Pins the entire global table to a Dashboard as either a table of values, bar chart or line graph.

Rows - This is the number of rows in the table.

Columns - This is the number of columns in the table.

Clear on Reset - If this box is checked, all number cells in the table will be set to 0 and cells with string data will be cleared when the model is reset.

Use Bundles - If this box is checked, the internal data type of the table will be changed to bundles. See the "Bundle Data" heading below.

Add Table to MTEI - This buttons adds the table as a row in the Multiple Table Excel Import.

Add Table to MTEE - This buttons adds the table as a row in the Multiple Table Excel Export.

- This button lets you add this table to a user library as either a draggable icon or as a component for automatic install. For more information, refer to the user library documentation.

Note: A similar window to this is used when editing a label table from an object's labels or when editing a node as a table (accessible through the right-click menu in the Tree Window or Labels page). However, the , , Clear on Reset and buttons will not be available.

Bundle Data

If the "Use Bundles" checkbox is checked, your table will change internally to use the bundle data type. This means that your table will take significantly less memory, and reading and writing from it during model run time will be much faster. However, there are some limitations. All data in a column must be of one type, namely number or string, and rows can no longer be named. The data type of a column can be changed by right-clicking on the column header. All of the normal table functions listed below will work with the bundle data type. Using bundles for your table data is highly recommended for large tables with over 500 rows or columns.

Commands

The following commands can be used with Global Tables. When specifying which Global Table, you may pass in the name of the Global Table as a string or you can use the reftable() command to pass in a double (this method is faster than accessing the table by name for multiple table commands). These commands may also be used with other tables in FlexSim by passing in the table's node. See the commands documentation for more information.

reftable("globaltable") Returns a reference to the Global Table that can then be passed into subsequent table commands.

gettablenum(table, row, col) Returns the number value stored in the table at the cell specified by row and col.

gettablestr(table, row, col) Returns the string value stored in the table at the cell specified by row and col.

settablenum(table, row, col) Sets the number value in the table of the cell specified by row and col.

settablestr(table, row, col) Sets the string value in the table of the cell specified by row and col.

gettablecell(table, row, col) Returns a reference to the cell (node) in the table specified by row and col.

settablesize(table, row, col) Sets the size of table to rows and cols. See commands documentation.

gettablecols(table) Returns the number of columns in table.

gettablerows(table) Returns the number of rows in table.

clearglobaltable(table) Writes zeros to all the number cells and clears the text in all string cells of the table.

addtablecol(table) Adds a new column to the table.

addtablerow(table) Adds a new row to the table.

deletetablecol(table, col) Deletes the specified column from the table.

deletetablerow(table, row) Deletes the specified row from the table.

movetablecol(table, col, newcol) Moves the table column col to newcol.

movetablerow(table, row, newrow) Moves the table row row to newrow.

gettableheader(table, row/col, rowcolnr) See commands documentation.

executetablecell(table, row, col) Executes the cell in table as Flexscript. If the cell contains number data, returns the number.

importtable(table, "filename", importcolheaders, importrowheaders) Imports table data from the file specified by filename from a .CSV format.

exporttable(table, "filename") Exports the table in .CSV format to the file specified by filename.



flexsim users manualusers manual
5 |100000

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

Article

Contributors

paul.t contributed to this article

Navigation

FlexSim 2016.1