Author Topic: Use of Tagged Values for version notes  (Read 2067 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10172
  • Karma: +329/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use of Tagged Values for version notes
« Reply #15 on: June 18, 2020, 02:24:59 pm »
In order to be able to debug vbscript, you need the Microsoft script debugger.
This used to be available on a Microsoft website bu they removed that download a few years ago.

I still have a copy of the installer here: https://drive.google.com/file/d/0B5YX31GyMA64NUJsQnJiaVhLWlk/view?usp=sharing

The ArrayList needs .Net 3.5. In windows 10 you can add that from the control panel

Geert

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #16 on: June 18, 2020, 10:34:32 pm »
Thanks, Geert. It worked! I am now seeing tagged values with the property "CR" and the value a GUID. Awesome!

I am not using SQL Server and just an EAP file, so I need to convert those two queries you provided to something Access can process, right?

Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10172
  • Karma: +329/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use of Tagged Values for version notes
« Reply #17 on: June 19, 2020, 01:32:51 am »
Yeah, they are already using the parentheses for the joins (not needed in SQL Server, only for MS Access), but you might need to adjust things such as substring()

Geert

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #18 on: June 19, 2020, 02:32:04 am »
The below worked in case anyone needs it. One odd thing was if I used the alias CLASSTYPE, I got an odd column containing symbols. Now that I have the query, how can I provide less skilled users with a way to run it and export the data? Can I put it into a script?

Geert this is really good stuff - I appreciate your attention to my posts.

Bill

SELECT o.ea_guid AS CLASSGUID, o.Object_Type AS CLASS_TYPE,
re.Name AS Release, cr.StereoType AS ChangeType, cr.Name AS ChangeRequest, o.name AS ChangedItem,
mid(op.notes, instr(op.notes, "date=")+5, 10) AS ChangeDate,
mid(op.notes, instr(op.notes, "comments=")+9, 500) AS ChangeComments,
mid(op.notes, instr(op.notes, "user=")+5, instr(op.notes, ";date") - instr(op.notes, "user=")-5) AS ChangeUser,
package.name AS PackageName, package_p1.name AS Package_level1, package_p2.name AS Package_level2, package_p3.name AS Package_level3
FROM ((((((((t_object o
INNER JOIN t_objectproperties op ON o.Object_ID = op.Object_ID)
INNER JOIN t_object cr ON cr.ea_guid = op.value)
LEFT JOIN t_connector crre ON crre.Start_Object_ID = cr.Object_Id)
LEFT JOIN t_object re ON (re.Object_Id = crre.End_Object_Id AND re.StereoType = 'Release'))
INNER JOIN t_package package ON o.package_id = package.package_id)
LEFT JOIN t_package package_p1 ON package_p1.package_id = package.parent_id)
LEFT JOIN t_package package_p2 ON package_p2.package_id = package_p1.parent_id)
LEFT JOIN t_package package_p3 ON package_p3.package_id = package_p2.parent_id)
WHERE op.Property = 'CR'

UNION

SELECT a.ea_guid AS CLASSGUID, 'Attribute' AS CLASS_TYPE,
re.Name AS Release, cr.StereoType AS ChangeType, cr.Name AS ChangeRequest, o.name +'.'+ a.Name AS ChangedItem,
mid(atv.notes, instr(atv.notes, "date=")+5, 10) AS ChangeDate,
mid(atv.notes, instr(atv.notes, "comments=")+9, 500) AS ChangeComments,
mid(atv.notes, instr(atv.notes, "user=")+5, instr(atv.notes, ";date") - instr(atv.notes, "user=")-5) AS ChangeUser,
package.name AS PackageName, package_p1.name AS Package_level1, package_p2.name AS Package_level2, package_p3.name AS Package_level3
FROM (((((((((t_attribute a
INNER JOIN t_attributetag atv ON a.ID = atv.ElementID)
INNER JOIN t_object cr ON cr.ea_guid = atv.value)
LEFT JOIN t_connector crre ON crre.Start_Object_ID = cr.Object_Id)
LEFT JOIN t_object re ON (re.Object_Id = crre.End_Object_Id AND re.StereoType = 'Release'))
INNER JOIN t_object o ON a.Object_ID = o.Object_ID)
INNER JOIN t_package package ON o.package_id = package.package_id)
LEFT JOIN t_package package_p1 ON package_p1.package_id = package.parent_id)
LEFT JOIN t_package package_p2 ON package_p2.package_id = package_p1.parent_id)
LEFT JOIN t_package package_p3 ON package_p3.package_id = package_p2.parent_id)
WHERE atv.Property = 'CR'

ORDER BY Release, ChangeType, ChangeRequest, ChangedItem

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #19 on: June 19, 2020, 06:56:34 am »
Geert,
Reference my previous question, I found you had touched on it here:
https://www.sparxsystems.com/forums/smf/index.php?topic=41323.0

You said: Another option is to write a small script that automates that. In such a script you could also directly export to Excel if you wanted to.


Do you have any examples of that?

Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10172
  • Karma: +329/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use of Tagged Values for version notes
« Reply #20 on: June 19, 2020, 01:58:28 pm »
You can either export your query, and have each user import it individually, or you can make an MDG technology file and add the search to it.
You can then deploy the MDG in the model (or on a fileshare) and all users can use the search without needing to import the search.

I have a couple of examples of excel export scripts here: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/search?q=excel&unscoped_q=excel

Geert

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #21 on: June 24, 2020, 12:20:57 am »
Geert,
In Project A I tried running both test.vbs and TestKristof.vbs and same error:

DAO.Database [0x000000c03]
Syntax error (missing operator) in query expression '(uc1.Object_ID = con.Start_Object_ID)    INNER JOIN t_object uc2 ON (con.End_Object_ID = uc2.Object_ID)'

Any ideas?

Bill

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10172
  • Karma: +329/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use of Tagged Values for version notes
« Reply #22 on: June 24, 2020, 01:42:19 am »
Probably because the query wasn't written for .eap file
I mostly work with SQL Server, so a lot of scripts work only on an SQL server repository.

If you check the file DBerror.txt in the %appdata%\Sparx Systems\EA folder, you can see the whole query that failed, and try it on the database you are on.

Geert

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #23 on: June 25, 2020, 02:04:50 am »
Of course you're right...I need to edit the queries...thanks!

Bill

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #24 on: July 01, 2020, 04:09:56 am »
Hi Geert,
I've got it all working now and am able to export the results of my query to Excel using a script in the Project Browser Group. It's pretty awesome!

I did have to work through a lot of errors with my query that were resolved when I removed the continuation character and just put it all on one line. I'm not sure what the issue was as I kept getting invalid character. After I put it on one line, I was able to then reinsert the continuation character and it worked, so I am thinking there were some invisible formatting characters present. Have you seen that?

One question I do have is, I am getting an extra column in my Excel output called Column1 with no content. I assumed this was because I had somehow specified another column in my query but I do not see how. Any ideas? My query is below.

Bill

   sqlGetContent = "select p.name AS Package, o1.name AS TargetClass, c.destrole AS ConnectorTag " & _
   "FROM (t_object o INNER JOIN (t_connector c INNER JOIN t_object AS o1 ON c.End_Object_ID = o1.Object_ID) " & _
   "ON o.Object_ID = c.Start_Object_ID) INNER JOIN t_package p ON o1.Package_ID = p.Package_ID " & _
   "WHERE not isnull(c.destrole) and lcase(o1.name) <> lcase(c.destrole)" & _
   "ORDER BY p.name, o1.name"

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10172
  • Karma: +329/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use of Tagged Values for version notes
« Reply #25 on: July 01, 2020, 01:55:05 pm »
Bill,

Looks like the array you are sending to excel as contents has one (empty) column to many.

Geert

bholtzman

  • EA User
  • **
  • Posts: 86
  • Karma: +2/-0
    • View Profile
Re: Use of Tagged Values for version notes
« Reply #26 on: August 02, 2020, 12:42:48 am »
Hi Geert,
Hope you're well. I have deployed your LinkToCR code and given a couple of demonstrations to team members. It works well. One thing they'd like to see is for the code to be triggered by a change to their model. So if they were to add a new attribute for instance, is there a way to then start the code so that a user cannot make changes without being reminded (or even forced) to associate the update with a CR? Thanks.

OK, I just saw this video:
https://www.youtube.com/watch?v=-BKJxCilD6c

So I can use EAMatic to trigger off user events, correct?

EAMatic looks like something the user has to download and set up. Is there another way to trigger your code from user events?

Bill
« Last Edit: August 03, 2020, 11:19:18 pm by bholtzman »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10172
  • Karma: +329/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Use of Tagged Values for version notes
« Reply #27 on: August 04, 2020, 08:29:56 pm »
Yes, EA-Matic is an add-in that can execute scripts and needs to be installed at EA installation.

You can do the same thing by

- writing your own add-in
- using a "model-addin" script (new since v15?)

Workflow scripts also somehow do stuff like that, but I've never really used those, so I'm not that sure what they can be used for.

Geert