Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: bholtzman on November 27, 2018, 01:37:03 am
-
Hi all:
I've had issues with trying to import Visio and other docs. I am finding I can spend the same amount of time or less writing my own importer, using Access or other means to perform inserts directly into EA tables. I've had success with t_object, t_attribute and t_connector. The great thing is how well I can control the process since I can specify the values in every column of these tables dynamically. It's a bit challenging to figure out what each field does, but once you've written the code the processing is a snap. There's also a lot of value in learning how the database is structured.
Has anyone had much experience along these lines and if so, were you able to make it work?
Bill
-
Bill,
It's much safer to use the API rather than to insert into the database directly.
See https://bellekens.com/2018/10/12/simple-vba-excel-to-ea-importer-v4-2/ (https://bellekens.com/2018/10/12/simple-vba-excel-to-ea-importer-v4-2/) for an example in Excel-VBA
Geert
-
Thanks Geert. I figured you'd say that but was just looking for a little guidance with my approach. I do think there are distinct advantages.
Bill
-
The main advantage of a database insert approach is speed (and a lot of it).
Except for Thoma's Kilians book "Inside Enterprise Architect" there isn't much documentation I'm afraid.
You'll have to do with a lot of "try manual and than look at the database".
It's not so difficult for just regular cases, but there are a LOT of "special" cases to consider.
Geert
PS. Any reason you specifically don't want to use the API?
-
To some degree it's just your typical engineer perspective - I want to know what's going on under the hood and modify it. To have granular control over the output enables me to tailor the resulting diagrams so that they are exactly what the customer is looking for. For instance, I've yet to figure out how to show both the alias and the name of an object on the diagram. I may have an object whose number is F.1.6 and name is Accept User Input, and I want both of these visible. So I import them both into the name field. I realize I could do that with an importer, but then I have to change the data instead of changing one line of code.
Or maybe I want to import something as a function of some logic. So if a certain field in the spreadsheet contains some string of text then I want the stereotype of the object to be "Message" but if not I want to include some other text string in parentheses in the Notes along with initials from a different field in the spreadsheet. I can do all of that with code. It's this kind of flexibility that I want and need.
Bill
-
I feel like we have bit of a misunderstanding.
When I say API I mean EA's programming interface.
I'm all for knowing how it works under the hood, and I use code all the time to manipulate models into doing exactly what I need them to do.
But unless there is no alternative I try to avoid updating the database directly.
I think I never actually inserted anything, only the occasional update if the API doesn't support some kind of feature.
I'm never 100% sure what all the fields would need to be filled in with, especially since there is so much variation.
Geert
-
OK, I see your code in the Excel file. Thanks!
Bill