21-03-2016 12:54 PM - edited 21-03-2016 12:54 PM
Hello All,
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,
Kartik
from
Colruyt
07-04-2016 08:50 AM
Can someone help me for this requirement.
Thanks in advance,
Kartik
23-03-2016 02:27 PM
Hello Lionel,
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.
Thanks,
Kartik
23-03-2016 02:08 PM
Hello Kartik,
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
Lionel
23-03-2016 12:11 PM
Hello Lionel,
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")
End sub
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.
Thanks,
Kartik
22-03-2016 04:55 PM
Hello,
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)
Regards
Lionel