Analytics.Engine.invokeTERRFunction()

Signature

Object[] invokeTERRFunction(String engine, String functionName, Object... args)

Domain

ACTION

Description

Calls the Terr engine and returns the function results.If engine pool name is passed as a parameter, the function will be executed in the Terr engine assigned to the thread invoking this function.

Parameters

NameTypeDescription
engineStringEngine or Engine Pool Name
functionNameStringFunction Name
argsObject...Element of Object.. should be String if it is TERR variable name or object if within BE node. It should be null if function doesn't take arguments

Returns

TypeDescription
Object[]

Cautions

Boolean values are returned in int format since there are 3 types of R: TRUE(1), FALSE(0), NA(-1)This function should be used after the TERR function is made known to TERR using engineExecute() When trying to pass non-primitive arrays, example DateTime[] or String[], then typecasting to Object is necessary
For example:-
String[] arr = {"Hello","World"};
Object myarr = arr;
Analytics.Engine.invokeTERRFunction("TerrEngineName","TerrFunctionName",myarr);

Example

Analytics.Model.invokeTERRFunction("engine1", "testFunction", args);
When the argument being passed is an array of Objects then it is needed to type case it to Object before passing it to invokeTERRFunction method.
For example:-
DateTime[] myDate = {DateTime.now(),DateTime.addDay(DateTime.now(),1);
Object myObjDate = myDate;
terrResult = Analytics.Engine.invokeTERRFunction("TerrEngine","getVector",myObjDate);
};