Book a Demo

Author Topic: Javascript which walk though the model  (Read 10356 times)

maselhappy

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Javascript which walk though the model
« on: August 31, 2019, 03:30:33 pm »
hi all,
I am searching for a JavaScript which walk through the model and on each block it extract the tagged values.

I have the extraction and naming finished but I am not sure how I can integrate this walk.

did you have a hint? or an example which I can use for understanding and adapting?

BR
marcel

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Javascript which walk though the model
« Reply #1 on: August 31, 2019, 07:57:51 pm »
Have you checked the Local Scripts.JavaScript - Recursive Model Dump Example
I think that does what you are looking for.

Be aware though that "walking" through the model this way is very time consuming.
Often it is a lot faster to use an SQL query to get the elements you need.

Geert

maselhappy

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Javascript which walk though the model
« Reply #2 on: August 31, 2019, 08:14:26 pm »
mmh,

can i also Export the tagged values into an CSV file with an SQL querie?

if yes I need an example....

thanks
marcel

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Javascript which walk though the model
« Reply #3 on: August 31, 2019, 08:42:04 pm »
Yes, you can do that directly using an SQL search. No need to write any javascript code.

Geert

maselhappy

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Javascript which walk though the model
« Reply #4 on: September 02, 2019, 11:01:30 pm »
Moin,

the first part is done:

select dbo.t_object.Object_ID, dbo.t_object.ParentID, dbo.t_object.Name, dbo.t_object.Package_ID, dbo.t_package.Package_ID, dbo.t_package.name
from dbo.t_object, dbo.t_package
where dbo.t_object.Package_ID = dbo.t_package.Package_ID;

the packages and Blocks are listend but also ports, so i have to select it better but i can't find the tag values. in t_taggedvalues are empty.

Br
marcel

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Javascript which walk though the model
« Reply #5 on: September 02, 2019, 11:02:57 pm »
t_objectproperties for element tags.

Geert

maselhappy

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Javascript which walk though the model
« Reply #6 on: September 02, 2019, 11:56:02 pm »
Thanks.

I have my first export and a 4.7 GB CSV File. :-) I like Excel.....

select dbo.t_object.Object_ID, dbo.t_object.ParentID, dbo.t_object.Name, dbo.t_object.Package_ID, dbo.t_package.Package_ID, dbo.t_package.name, dbo.t_objectproperties.Property, dbo.t_objectproperties.Value
from dbo.t_object, dbo.t_package, dbo.t_objectproperties
where dbo.t_object.Package_ID = dbo.t_package.Package_ID;

Br
Marcel


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Javascript which walk though the model
« Reply #7 on: September 03, 2019, 12:28:13 am »
I have my first export and a 4.7 GB CSV File. :-) I like Excel.....
4.7 GB  :o  That is extremely big; and I see why.
You are not joining t_object properties with anything, so you are getting a cross join of all both tables
If I were to write a query like that it would look like this:

Code: [Select]
select o.Object_ID, o.ParentID, o.Name, o.Package_ID, p.Name as PackageName, tv.Property as TagName, tv.Value as TagValue
from ((t_object o
inner join t_package p on p.Package_ID = o.Package_ID)
left join t_objectproperties tv on tv.Object_ID = o.Object_ID)

Geert

maselhappy

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Javascript which walk though the model
« Reply #8 on: September 03, 2019, 04:54:52 pm »
Thanks.

It looks now better and Excel compatible. I have a lot of inEncapsulated TaggedValue which i will remove form the export. so that i will also save some bytes.

Br
Marcel