Book a Demo

Author Topic: Parsing SubPackages  (Read 3356 times)

utilisateurEA

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Parsing SubPackages
« on: June 14, 2010, 06:04:06 pm »
Hello,

I'd like to write a script parsing all the diagrams of my model.
For now I can only "read" the diagrams under the selected package with:

EA.Package curPk = R.GetTreeSelectedPackage();
foreach (EA.Diagram D in curPk.Diagrams)
...

Do you know how could say "all the diagrams of the model" or "all the diagrams of the selected package and associated sub-packages" (the result would be the same if I selected the top level package)

Thank you.
« Last Edit: June 14, 2010, 06:04:47 pm by utilisateurEA »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Parsing SubPackages
« Reply #1 on: June 14, 2010, 06:21:54 pm »
The best you can do is use Repository.SQLQuery to get the id's of the diagrams you are interested in, and then get them one by one using Repository.GetDiagramByID

Geert

utilisateurEA

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: Parsing SubPackages
« Reply #2 on: June 15, 2010, 12:35:21 am »
Thanks,

But how do you use SQLQuery ?

I tried
 
while (stop == 0)
{
    try
    {
         DiagID[i_diag] = R.SQLQuery("select Diagram_ID from t_diagram");
          i_diag++;
    }
    catch
    {
           stop = 1;
     }
 }

But it doesn't seem to work

thanks

beginner

  • Guest
Re: Parsing SubPackages
« Reply #3 on: June 15, 2010, 02:02:06 am »
The help file is quite helpful... Tells something about xml and so. I wouldn't say this if it was a Mickeysoft help file. But Sparx help is actually helpful.

b.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Parsing SubPackages
« Reply #4 on: June 15, 2010, 04:20:50 pm »
You can also search for SQLQuery in the forum. (using top left button)
I've posted several examples of how to use that in the past.

Geert