I notice a Macro can connect to a MetaAssociation. What are available VB functions that I can implement for this Macro in order to execute some actions after an asociation is established.
Eg. When connect an application to a database, also connect the application to data model of the database. Thanks
Solved! Go to Solution.
I'm sorry, but there are not (yet ?) ways to execute a macro when establishing an association between object.
Macros linked to metaAssociations have other internal purposes (for managing links with virtual metamodel for example).
A community is a way to have fun no ?
So if you want to trigger a macro when there is an event on a metaAssociation ... you can create a rule on the metaclass and when there is a new or a change in the number of associated objects in a MetaAssociation the macro linked with the Modeling Rule is executed ... But a little tricky no ?
sounds like a good trick I could use but I do not understand one point :
How do you know that there is a change in the number of associated objects ? According to what I know, the macro will be executed almost everytime you modify the object and/or open a diagram with the object inside, and not only when you create a new metaAssociation (which, depending on what you want do do, might not be a problem...)
The only thing I see, to respond to linhbui's problem, would be something like :
For each oDataBase in oToBeRuled.getCollection("DataBase") <...> Next
Which means the <...> code will be executed each time the rule is applied, even when no changes has been made in the number of metaAssociations.
How do you manage this ?