Analytics.Engine.invokeTERRFunction()
Signature
Object[] invokeTERRFunction(String engine, String functionName, Object... args)
Description
Calls the Terr engine and returns the function results.
Parameters
Name | Type | Description |
engine | String | Engine Name |
functionName | String | Function Name |
args | Object... | 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 |
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);
};