cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Computed MetaAttribute Macro not executing

RalfMieke
Super Contributor

We need a computed MetaAttribute, however the process from the KB-Article http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqWBAAY doesn't lead to a working example.

These are the steps we followed:

- create a new MetaAttribute

- set _AtNature to "Virtual"

- connect a new Macro

Code of the Macro:

 

'MegaContext(Fields,Types)

'To Implement if you want to have a computed value for this attribute
Sub GetAttributeValue(Object as MegaObject,AttributeID as Variant,Value as String)
               MsgBox("Hello, World")
               Value = "Y"
End Sub

'To Implement instead of GetAttributeValue if you want to manage a specific display or extended value
'Format : 0 internal, 1 external, 3 Display, 5 externalCode
'Sub GetExtendedAttributeValue(Format as Integer,Object as MegaObject,AttributeID as Variant,Value as String)
'End Sub

'To Implement if you want to overload the update of this attribute
Sub SetAttributeValue(Object as MegaObject,AttributeID as Variant,Value as String)
               MsgBox("Hello, World")
End Sub

'To Implement instead of SetAttributeValue if you want to manage a specific display or extended value
'Format : 0 internal, 1 external, 3 Display, 5 externalCode
'Sub SetExtendedAttributeValue(Format as Integer,Object as MegaObject,AttributeID as Variant,Value as String)
'End Sub

'To Implement for a Text attribute to fix the text format of the given text
'Sub GetTextFormat(Object as MegaObject,AttributeID as Variant,Value as Variant)
'End Sub

- set _ExecutionOptions to 0x4 (Restricted MEGA Globals)

 

After saving and publishing changes, we expected some kind of feedback from the macro when working with the attribute (From the MsgBox("Hello, World")), however this does not happen and the attribute appears to function just like a regular String attribute. To trigger the execution we tried both modification via the Property page (UI) and via the MEGA-Api (setProp, getProp methods).

How can we make a functional computed MetaAttribute

 

Our MEGA Version is 2009 SP 5 Patch 8 if that is necessary.

2 Replies

jhorber
MEGA
MEGA

Hello Ralf

 

Full MEGA Globals options is only a compatibility mode. Do not keep this code

 

This compatibility mode is not garanteed for versions higher that MEGA 2007.

A macro with Full MEGA Globals options must not be considered as a reliable component and therefore can not be used as such.

 

See  http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mqTBAAY

Jerome

SVanSchoonlandt
Honored Contributor

try this as script

 

Sub GetAttributeValue(ByVal oObject, ByVal vMetaAttributeId, ByRef Value)

Value = "Y"

Msgbox "Hello"

end sub

 

Execution options I don't use normally. I do set the permission of the attribute to activate gui spefication so it is a ready-only attribute

 

REgards

 

stijn