cancel
Showing results for 
Search instead for 
Did you mean: 

How to call an function in an extension?

Former Member
0 Kudos

Hopefully this is a nice and easy question. I'm looking to call a global Extension function  (and ideally a "method Script" function) from the "Edit/Run Script" functionality - basically I have custom functions within an extension and want to call that via automation. Aka not from within the context of the model, but from the "ActiveModel" context.

Dim Model
Set Model = ActiveModel
Model.EXTENSION.Procedure "Param1", "Param2

The goal is to automate calling some functions that have been coded within the XEM across a number of models. I have most of the parts all covered, but I'm stumbling on actually calling/invoking a function within the XEM - and I suspect it is easy once you know it. Obviously the above doesn't work, but any ideas or pointers would be gratefully received,

Many thanks - Gareth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gareth,

you can do this pretty easily. But there are two conditions which must be fullfilled.

1) The extension should be attached to the model, in which you want to use it.

2) You cannot call directly Global script function/procedure, but you have to call it through certain interface. So I recommend to create methods for the Model metaclass for example, which would do nothing but call your procedure defined in Global script.

The syntax is quite simple:

ActiveModel.ExecuteCustomMethod("ExtendedDefinition_1.MyMethodName")

Ondrej

Former Member
0 Kudos

Perfect - that is exactly what I was looking for! Many thanks,

Gareth

Answers (0)