Page 1 of 1

Write to Instance Table

PostPosted: Mon Feb 25, 2019 10:08 am
by cpadilla@tamu.edu
Is there a way to write values to instance table cells using the OpenAPI? I have a .csv file I want to read from using Java's File I/O and write its values into an instance table. I'm trying create something similar to the Import/Export feature on the Table Toolbar but without needing to click it using the UI. I've looked at the GenericTableManager class, but that seems to be useful only for reading from the table, not writing to the table.

Also, unfortunately the Table Import/Export Plugin (which contains exactly the functionality I'm looking for) is not OpenAPI (and I've tried to trace its code to figure out what it's doing, but it's impossible to read). :cry:

Thanks,
Chris

Re: Write to Instance Table

PostPosted: Wed Mar 13, 2019 11:59 am
by gdhardy1
See API for StereotypesHelper class.

Use StereotypesHelper.setPropertyValue() method to set the value of the "rowElements" property on the "DiagramTable" stereotype for the Instance Table element you are writing to.

The "rowElements" property value object should be a list of "Element Server ID" strings corresponding to the list of elements that you wish to add to the table.

Considering you are trying to import from an excel sheet, you'll need to first create the instance specification elements using the ElementsFactory class.

Re: Write to Instance Table

PostPosted: Wed Mar 13, 2019 1:08 pm
by cpadilla@tamu.edu
gdhardy1 wrote:See API for StereotypesHelper class.

Use StereotypesHelper.setPropertyValue() method to set the value of the "rowElements" property on the "DiagramTable" stereotype for the Instance Table element you are writing to.

The "rowElements" property value object should be a list of "Element Server ID" strings corresponding to the list of elements that you wish to add to the table.

Considering you are trying to import from an excel sheet, you'll need to first create the instance specification elements using the ElementsFactory class.



Thanks for the response, I ended up using an internal API call (not ideal) which works for now. But I will go back and try this more lucrative method when I get the chance.