Author Topic: Swim lanes in the database  (Read 3383 times)

bholtzman

  • EA User
  • **
  • Posts: 93
  • Karma: +2/-0
    • View Profile
Swim lanes in the database
« on: June 08, 2022, 01:00:44 am »
Hi:
We're looking to leverage swim lane data from the database and implement some swim lane automation. I see that swim lane data is contained in the t_xref but I don't see any references to that data. How does Sparx know which diagrams to associate with the swim lane? Thanks.

Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Swim lanes in the database
« Reply #1 on: June 08, 2022, 04:02:00 am »
There's a link between t_xref.client and t_diagram.ea_guid

Code: [Select]
select * from t_xref x
inner join t_diagram d on d.ea_guid = x.Client
where x.type = 'swimlane'

But you don't even need that. The API exposes swimlanes as well: https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/swimlane.html

Geert

bholtzman

  • EA User
  • **
  • Posts: 93
  • Karma: +2/-0
    • View Profile
Re: Swim lanes in the database
« Reply #2 on: June 08, 2022, 06:38:23 am »
Thanks, Geert, you're always right and always helpful.

A couple of follow-up questions if you don't mind:
- What is the significance of t_xref.requirement? The values I see are of the form SW=249;
- Is there any meaningful data in t_xref.description?
- t_xref.partition determines which swim lane is furthest left correct? where does Sparx keep track of the width of the swim lane?
- I am guessing there is no way to extract which objects are in which swim lanes, other than some kind of complex geometry thing. It seems you can put the objects so they straddle swim lanes.
- Can you envision code that would generate rows in t_xref and insert a swim lane into a diagram?

You're the best!

Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Swim lanes in the database
« Reply #3 on: June 08, 2022, 02:31:53 pm »
- SW in the requirement field indicates the width
- The description contains (in my case on v16 anyway) the guid's of the elements that are found in this swimlane
- Partition indeed contains the order
- You can either rely on the guid's the t_xref, or use the geometry. There nothing complex about that. The diagramObject has a left and right property. You simply have to compare that to the sum of the width's of the simlanes.
- No, you shouldn't insert rows if the database if there is an API available to do the hard work for you.

Geert

bholtzman

  • EA User
  • **
  • Posts: 93
  • Karma: +2/-0
    • View Profile
Re: Swim lanes in the database
« Reply #4 on: June 09, 2022, 01:46:03 am »
Awesome. The Sparx interface isn't always ideal but behind the scenes everything makes sense and having access to that knowledge here is super helpful.

Bill

bholtzman

  • EA User
  • **
  • Posts: 93
  • Karma: +2/-0
    • View Profile
Re: Swim lanes in the database
« Reply #5 on: July 06, 2022, 11:46:43 pm »
Geert,
My swim lane automation works well - thanks so much. Quick question: What is the significance of the SEQUENCE field in t_diagramobjects? I wonder if I should update it when I rearrange the objects in the diagram.

Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Swim lanes in the database
« Reply #6 on: July 06, 2022, 11:47:59 pm »
Geert,
My swim lane automation works well - thanks so much. Quick question: What is the significance of the SEQUENCE field in t_diagramobjects? I wonder if I should update it when I rearrange the objects in the diagram.

Bill
IIRC that's the Z-order.

Geert

bholtzman

  • EA User
  • **
  • Posts: 93
  • Karma: +2/-0
    • View Profile
Re: Swim lanes in the database
« Reply #7 on: July 07, 2022, 01:17:44 am »
OK, so when I move the objects with my code by updating the RECTTOP value I need to update the SEQUENCE value as well. Thanks!