Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: kpietrusewicz on January 09, 2018, 09:36:27 am

Title: MDG - Calculating a tagged value from other tags - simple example for beginners
Post by: kpietrusewicz on January 09, 2018, 09:36:27 am
Hello Friends,
I am using Enterprise Architect 12.1 Ultimate Edition.
I started my journey with creation of own meta-models with the use of MDG technology.

I am the beginner and would like to ask You for help with the topic as follows:
1. 'stereotype_1' with tagged values: Integer1, Integer2
2. 'stereotype_2' with tagged value: Integer3, Integer4, Integer5

Within the model I will have plenty of 'stereotype_1' elements, while only couple of 'stereotype_2' for summary of information from 'stereotype_1' elements.

It will be like:
1. Integer3 = sum of all Integer1 values from the same diagram
2. Integer4 = percentage of Integer2 values from the same diagram, with some given Integer5 max value

My question is how to update tagged values from 'stereotype_2' based on the values from tagged values of 'stereotype_1'.

Thank You for Your kind support!
Title: Re: MDG - Calculating a tagged value from other tags - simple example for beginners
Post by: qwerty on January 09, 2018, 09:57:00 am
There's noting out of the box for that. But there are two alternatives. First you can run a simple (!) script that does the calculation and updates everything according to your rules. That should be doable in a day (or even less). The second is more comfortable but also more labor for the programmer. An add-in can check for tag updates and do the calculation on the fly. It's not that difficult and could be implemented as a second step.

q.
Title: Re: MDG - Calculating a tagged value from other tags - simple example for beginners
Post by: Nabil on January 09, 2018, 06:23:30 pm
Hello Friend,

Run a script which does this tag calculations and update it. (This you have to run every time manually)
 or
As you have mentioned based on elements on diagram. I assume elements are already created based on diagram change you need to perform this operation.
you can try EA_OnPostNewDiagramObject & EA_OnPostCloseDiagram events put your logic in this will do the things on fly you can combine your MDG with Addin as well.

Best Regards
Nabil



Title: MDG - Calculating a tagged value from other tags - simple example for beginners
Post by: kpietrusewicz on January 13, 2018, 10:19:55 am
Thanks for Your kind response :-)
Yes, it took one working day.
Script is not perfect, but solves my problem.
Best regards,
Krzysztof

 :)