Author Topic: Extract the list Actions for each Actor  (Read 278 times)

ea0921

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Extract the list Actions for each Actor
« on: September 22, 2022, 08:33:51 pm »
Hi,

I created my Actors (Actor1, Actor2). Next I created an activity diagramm in which as swimmlines I used two partitions that have as instance classifier = Actor1 and Actor2. I therefore have two vertical partitions :Actor1 and :Actor2.
In each swimmline I then inserted and linked the Actions.
I then created n other activity diagrams with the same logic.
I would now like to create a list that extracts for each Actor which Actions it is associated with. I started with the idea that by making partitions-instances of Actors and inserting Actions into these partitions, I can extract which Actions are associated with which Actors.

Is it possible?

Thanks


qwerty

  • EA Guru
  • *****
  • Posts: 12893
  • Karma: +369/-296
  • I'm no guru at all
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #1 on: September 22, 2022, 09:30:47 pm »
Should be possible with a custom query. The actions are children of the pools so there is a relation with the parent_id. The pools are classified via the classifier_id.

q.

ea0921

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #2 on: September 23, 2022, 12:37:24 am »
I have never created custom queries. How do I do that?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11935
  • Karma: +464/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extract the list Actions for each Actor
« Reply #3 on: September 23, 2022, 12:48:32 am »

qwerty

  • EA Guru
  • *****
  • Posts: 12893
  • Karma: +369/-296
  • I'm no guru at all
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #4 on: September 23, 2022, 02:24:39 am »
In order to create a meaningful query you need to know the database structure. That's a bit of a PITA but worth the effort if you want to use EA "for real".

q.

Takeshi K

  • EA User
  • **
  • Posts: 435
  • Karma: +18/-1
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #5 on: September 23, 2022, 05:28:38 pm »
Hello ea0921,

Maybe what you want to do is the first image in the following URL:
https://www.sparxsystems.jp/en/trace/

HTH,
--
t-kouno

satrman

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #6 on: September 23, 2022, 06:40:16 pm »
It is very simple SQL, as mentioned before.
Actually there are two ways how to do that.
One is via t_object.ParentID and the other one is via x,y coordinates on t_diagramobjects. The second way reflects "Diagram reality", the first one "Browser reality".
"Diagram reality" approach solves several potential problems:
1. if some elements have been removed from diagram but not deleted from model
2. if you ever need activities to be stored somewhere else than under swimlanes
3. if you ever interested in ordered list of activities as they appear on diagram (left->right, top->down)

This is good case for learning SQL:
- "Browser reality" approach needs t_object table only
- "Diagram reality" approach needs t_object and t_diagramobjects
I definitelly recommend learning so called "macros" from this source (most important one is #Branch# macro, which will solve the poblem of pointing your SQL to particular model branch):
https://sparxsystems.com/enterprise_architect_user_guide/15.2/navigation/creating_filters.html

ea0921

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #7 on: September 23, 2022, 07:32:06 pm »
Hello ea0921,

Maybe what you want to do is the first image in the following URL:
https://www.sparxsystems.jp/en/trace/

HTH,

Yes, maybe. I wanted to download the trial version but I got a "Server error"

ea0921

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #8 on: September 23, 2022, 07:41:11 pm »
In order to create a meaningful query you need to know the database structure. That's a bit of a PITA but worth the effort if you want to use EA "for real".

q.

I have tested and it meets our requirements. But I have this problem.
If I use my query in a EA-File-Project, the query extracts all the values.

If I use my query in a EA-MsSql-Repository the Query Builder doesn't extract all the values.
Column t_package.Name doesn't extract any value.

The same query on SQL Management Studio extracts all values for all columns


This is the query

Code: [Select]
select t_package.Name, t_diagram.Name from t_object partition, t_object actor, t_object action, t_package, t_diagram, t_diagramobjects
where partition.object_type = 'ActivityPartition'
and actor.object_type = 'Actor'
and action.object_type = 'Action'
and partition.classifier_guid = actor.ea_guid
and action.parentID = partition.Object_ID
and action.package_id = t_package.Package_ID
and t_diagram.Diagram_ID = t_diagramobjects.Diagram_ID
and action.object_id = t_diagramobjects.Object_ID



Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11935
  • Karma: +464/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Extract the list Actions for each Actor
« Reply #9 on: September 23, 2022, 08:08:34 pm »
the problem is that you have twice the column Name in your query.

Give the package name a different alias, and you should be fine

Code: [Select]
select t_package.Name as PackageName, ...
Also, it's a good idea to use proper join syntax to keep your sanity.

Something like this:

Code: [Select]
select act.ea_guid AS CLASSGUID, act.Object_Type AS CLASSTYPE,
p.Name as PackageName, actor.Name as ActorName, act.Name as ActionName, d.Name as DiagramName, act.ea_guid
from t_object prt
left join t_object actor on actor.Object_ID = prt.Classifier
and actor.object_type = 'Actor'
inner join t_object act on act.ParentID = prt.Object_ID
and act.object_type = 'Action'
inner join t_package p on p.Package_ID = act.Package_ID
left join t_diagramobjects do on do.Object_ID = act.Object_ID
left join t_diagram d on d.Diagram_ID = do.Diagram_ID
where prt.object_type = 'ActivityPartition'
and p.Package_ID in (#Branch#)

PS. If you want this to work on a .eap file you'll need to add a bunch of parentheses to cater for weird the MS-Access syntax.

Geert

Takeshi K

  • EA User
  • **
  • Posts: 435
  • Karma: +18/-1
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #10 on: September 23, 2022, 08:46:48 pm »
Yes, maybe. I wanted to download the trial version but I got a "Server error"

I could not reproduce the issue, but I have sent the trial key to your email address. Please enjoy it!
--
t-kouno

ea0921

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #11 on: September 24, 2022, 02:03:59 am »
Yes, maybe. I wanted to download the trial version but I got a "Server error"

I could not reproduce the issue, but I have sent the trial key to your email address. Please enjoy it!

Now it works

ea0921

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #12 on: September 24, 2022, 02:06:36 am »
the problem is that you have twice the column Name in your query.

Give the package name a different alias, and you should be fine

Code: [Select]
select t_package.Name as PackageName, ...
Also, it's a good idea to use proper join syntax to keep your sanity.

Something like this:

Code: [Select]
select act.ea_guid AS CLASSGUID, act.Object_Type AS CLASSTYPE,
p.Name as PackageName, actor.Name as ActorName, act.Name as ActionName, d.Name as DiagramName, act.ea_guid
from t_object prt
left join t_object actor on actor.Object_ID = prt.Classifier
and actor.object_type = 'Actor'
inner join t_object act on act.ParentID = prt.Object_ID
and act.object_type = 'Action'
inner join t_package p on p.Package_ID = act.Package_ID
left join t_diagramobjects do on do.Object_ID = act.Object_ID
left join t_diagram d on d.Diagram_ID = do.Diagram_ID
where prt.object_type = 'ActivityPartition'
and p.Package_ID in (#Branch#)

PS. If you want this to work on a .eap file you'll need to add a bunch of parentheses to cater for weird the MS-Access syntax.

Geert

Thanks Geert Bellekens it works! Is it possible to centralise this search in the company? Or do we have to export/import on each PC?

qwerty

  • EA Guru
  • *****
  • Posts: 12893
  • Karma: +369/-296
  • I'm no guru at all
    • View Profile
Re: Extract the list Actions for each Actor
« Reply #13 on: September 24, 2022, 06:34:01 am »
You can include searches in MDG files. I'm doing that with an external scipt (and have not used it in  while). Was no rocket science and documented somewhere...

q.