Can anyone suggest :
How to fill the metaattribute dynamically.
(For example, 'MessageFlow' object Local name - Source --> Target))
I have a new metaclass for which I am able to create a 'Local name'(MetaAttribute) of the object dynamically.
But, I am unable to fill it same like MessageFlow Local name.
I am using AttCtl_SetText function in MetaAttributeUpdateTool macro.
But this is getting fired everytime when I open 'Properties' of the object. This should not happen.
Function should trigger only for the first time of the object creation not always opening properties.
Am I using correct function/macro ? ?
Thanks in advance,
if you want a computed value for a metaAttribute, you need to
1 - Set the "_AtNature" property of your metaAttribute to "Virtual"
2 - On your metaAttribute : "right click > New > Macro"
3 - In the macro, use the "getAttributeValue" Sub (the "Value" parameter of this sub will be the displayed value in your metaAttribute)
Thanks for the reply.
I am trying to create a dynamic message.
So, unless the object is created I cannot create a message.
Eg: Source --> Target
From GetAttributeValue I think we can only get static message.
See below code:
Sub GetAttributeValue(Object as MegaObject,AttributeID as Variant,Value as ByRef)
Value = Object.getCollection("Source Flow Element").item(1).getProp("Name") & "-->" & Object.getCollection("Target Flow Element").item(1).getProp("Name")
When I execute this, I get Empty object invocation error.
Which is expected because 'Object' is not created yet here.
Thats the reason, I tried with AttCtrl_SetText function of Metaattribute updateTool macro.
Waiting for your reply.
why don't you just "test" the existence of your source and target element ?
Sub GetAttributeValue(Object as MegaObject,AttributeID as Variant,Value as ByRef) Dim SourceObject, TargetObject Value = "" Set SourceObject = object.getCollection("Source Flow Element").Item(1) Set TargetObject = object.getCollection("Target Flow Element").Item(1) If SourceObject.getId <> 0 AND TargetObject.getId <> 0 Then Value = SourceObject.Shortname & "-->" & TargetObject.ShortName End If End sub
Thanks for your reply.
I can test but my requirement is to fill the attribute with source and target mandatorily.
A 'Flow' cannot exist without 'Source' and 'Target'. So when I do Object--rightClick--Properties I need to see Source-->Target message.