15-11-2012 09:47 AM
Dear Community,
I need to save a variable value between two VB macros. My first macro to determine "master application" in a diagram
and second macro to condition graphical link representation (depending if Triggered application or Triggering)
But I did'nt find in documentation the way to save a value in a macro (in temp file, in registry, ...) and how to retrieve this value in an other macro.
Do you have any ideas?
Thanks and
Regards
jacques demeusy
Solved! Go to Solution.
21-11-2012 04:28 PM
Hello Lionel
Indeed when I open Properties and Characteristics Tab of my diagram, I see my trace but not when opening my diagram (as you said)
In fact my requirement is to determine the current opened diagram name to select relevant MetaPicture for each object (Application, Interaction)
Because in my logic relevant MetaPictures are depending on contextual Master Application (for the current diagram)
As I have now the possibility to determine Master Application from current diagram name (thanks for your ex) so I think my issue is solved
Of course the best solution would be to determine just one time (at diagram opening) the Master Application. Currently I determine it on each API activation (on each Object MetaPicture condition)
Jacques
21-11-2012 03:50 PM
Hello Jacques,
this macro is not supposed to be excecuted when you open the diagram.
Your new metaAttribute (that should be visible in the property pages of your diagram) is updated whenevever the master application is changed. If you have no master Application, this attribute will remain empty. Opening the diagram will not change anything.
But maybe I did not understand your question ?
Lionel
21-11-2012 03:45 PM
Hello Lionel
Sorry but I've strictly followed your instructions : new MetaAttribute for "Diagram" MetaClass + New macro connected to this MetaAttribute
But when I open my diagram (Application Env Diagram), this macro is not excuted (because I don"t see the trace taht I put in it)
Do I have something else to acitivate ?
bests regards
Jacques
21-11-2012 03:02 PM
Thanks Lionel for your excellent explanation which will allow me to solve my issue
For your information. It's easy to define Master application becaue it is part of Current Diagram Name
Rgds
Jacques
15-11-2012 04:22 PM - edited 15-11-2012 04:32 PM
Hello Jacques,
If you are able to determine automatically which one is the master application on your diagram (and I think you are considering that you already wrote a macro to do it) , you should consider creating a calculated MetaAttribute on the Diagramme MetaClass. This MetaAttribute would be automatically filled with the name (or the absolute identifier) of the master application if it exists (using the macro you already wrote)... It would then be easy to get this value in any macros.
To do so, create a new MetaAttribute (called MASTER Application for example...) on the Diagram MetaClass.
Update its _AtNature to "Virtual" and Permission to "0x20F" (meaning you checked the "Activer la spécification par l'IHM" as shown in below screenshot) --> this last point is to disable modification of this metaAttribute (only your macro will modify it) :
Then create a macro linked tp your new metaAttribute and implement it this way :
'MegaContext(Fields,Types) 'To Implement if you want to have a computed value for this attribute Sub GetAttributeValue(myDiagram as MegaObject,AttributeID as Variant,Value as String) Value = "" For each objApplication in myDiagram.getCollection("~0sUip9B5iid0[Application]") If <your condition to find the master application> Then value = objApplication.getProp("~310000000D00[Identifiant absolu]") 'or the name, or ...
exit sub end If Next End Sub
If you do not like/want this solution, you still have the possibility to create, as you mentioned, a specific text file where you would store the information. You could either use one global text file storing the information for all your diagrams, or many temporary text files, one for each diagram, with a specific name for each ones to know where to look for the information.