Book a Demo

Author Topic: Linking messages and operations using SQL  (Read 6952 times)

Polymorph

  • EA User
  • **
  • Posts: 136
  • Karma: +4/-0
    • View Profile
Linking messages and operations using SQL
« on: November 30, 2016, 07:51:30 am »
Can anyone suggest an SQL query that would be able to link a message on a sequence diagram to the actual operation on the block which classifies the lifeline.

The connector that represents the message the diagram has the same name as the operation, but... It also has parenthesis after the name. This means that trying to do an SQL JOIN statement doesn't work, since the name of the actual operation excludes the parentheses.

I'm no SQL guru so there might be a clever way to construct the query... Or perhaps there is another table with the info...?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Linking messages and operations using SQL
« Reply #1 on: November 30, 2016, 08:39:17 am »
I'm also no SQL guru, but those things are usually quite DB dependent. So you should state which RDBMS you are targeting. E.g. the SUBSTRING function in Mickeysoft Access (aka EAP) is named MID.

q.

P.S.
Code: [Select]
SELECT mid(name,1, instr(1,name,'(',0)-1) from t_connector will strip the name before the parenthesis.
« Last Edit: November 30, 2016, 08:50:41 am by qwerty »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Linking messages and operations using SQL
« Reply #2 on: November 30, 2016, 09:27:38 am »
The message will have a tagged value "operation_guid" which contains the GUID of the operation. The tagged value will be in the table t_connectortag, the message in t_connector and the operation in t_operation.
The Sparx Team
[email protected]

Polymorph

  • EA User
  • **
  • Posts: 136
  • Karma: +4/-0
    • View Profile
Re: Linking messages and operations using SQL
« Reply #3 on: November 30, 2016, 08:33:56 pm »
Excellent - that worked a treat!