Apama 10.3 | Apama Documentation | Building and Using Apama Dashboards | Building Dashboard Clients | Using Dashboard Functions | Creating custom functions | Developing a custom-function library | Implementing evaluateFunction
Implementing evaluateFunction
Implement this method to evaluate a specified function with specified actual arguments. The function is specified with the function name. The arguments are specified with an instance of com.apama.dashboard.data.IVariableData.
For functions that return table data, use the factory class com.apama.dashboard.data.TabularDataFactory to create an instance of ITabularData.
When you compile your implementation, ensure that ap-dashboard-client.jar is on your class path. This jar file is in the lib directory of your Apama installation.
Your implementation of evaluateFunction can set or retrieve substitution values, if necessary, by using the following methods of DashboardManager and IDashboardContext:
*DashoardManager.getFunctionDashboardContext: This static method takes as argument an instance of IVariableData and returns an instance of IDashboardContext. Pass the instance of IVariableData that is passed into evaluateFunction.
*IDashboardContext.getSubstitutionValue: Gets the value of a substitution with a given name.
*IDashboardContext.setSubstitution: Sets the value of a substitution with a given name.
*IDashboardContext.setSubstitutions: Sets the values of substitutions, where the substitutions and values are specified with String vectors.
Each set method has a boolean argument, triggerUpdate, which controls whether objects attached to the substitution are updated. If it is false, they are not. If the substitutions are only used as command parameters or in drilldowns, you can improve performance by specifying false.
Here is an example:
IDashboardContext ctxt =
String val1 = ctxt.getSubstitutionValue("$subst1");
ctxt.setSubstitution("$subst2", "val2", false);

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.