question

martin.j avatar image
1 Like"
martin.j asked anthony.johnson edited

Accessing Property Tables

Th new Property Tables are quite clever, but I am wondering if there is a way to import and export sets of properties by importing and exporting a Property Table?

I imagine making a Property Table showing machine properties for an array of machines. I would then export that table to excel where it can be altered, duplicated and more. I would then inport an excel table to quickly update all the machines settings and run a test with them.

How would i go about doing that, and is there a way to get/set information in the table through code, or does it have to be through SQL queries?

FlexSim 20.2.3
flexsim 20.2.3excel importsql queryexcel exportproperty table
5 |100000

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

anthony.johnson avatar image
2 Likes"
anthony.johnson answered anthony.johnson edited

I wanted to include some type of export/import mechanism for property tables when I developed them, but there were technical hurdles that I couldn't solve in time, so unfortunately it's not there now.

However, you can, with a little SQL, implement an import/export mechanism that uses global tables as a middle man.

To create and update a global table for exporting to Excel:

  1. Table.query("SELECT Name, Prop1, Prop2, ... FROM Objects() WHERE ...").cloneTo("ObjectProps");

Then you can export that table to Excel. Then, after changes are imported from Excel:

  1. Table.query("UPDATE Objects() AS Object INNER JOIN ObjectProps ON Object.Name = ObjectProps.Name SET Object.Prop1 = ObjectProps.Prop1, Object.Prop2 = ObjectProps.Prop2, ...");

This will do a join on the global table and the objects in the model, matching the object name, and set the object properties accordingly. Here you would need to make sure your objects are named uniquely, or you could use some other uniquely identifying attribute.

Note: Unfortunately the UPDATE clause with INNER JOIN is not implemented properly in the 21.0.1 release. We were trying to bring the syntax inline with SQL Server syntax, but ended up breaking the syntax. So you will need to wait until the 21.0.2 release to use this.

· 5
5 |100000

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

Lars Jacobsen avatar image
1 Like"
Lars Jacobsen answered

Currently it is not possible to use Excel import and export for a property table. The property table is basically a "view" of a selected part of the object tree. Thus you will have to use code and sql statements for export, updates and inserts. Very relevant for future development including the new Model Parameter Tables and Experimenter Scenario Table. @anthony.johnson

5 |100000

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