About the Calculator Component API

The Calculator component provides an API for programmatically configuring the Calculator component using a Java program.

For information about component APIs, see Component APIs.

The Calculator component API consists of the following methods:

  • getString("expression"), set("expression", myExpression). This method allows you to get/set the value of the expression as a string. When setting the value of an expression, this method overwrites the previous value.

  • add("calculation", oneCalculation). This method adds a new calculation to the end of the current expression.

After you call the set() or add() methods, you must call the apply() method to store the new expression in the Calculator component. The new expression can contain undefined parameters. Calling the apply() method adds these undefined parameters to the component with suitable mode, data type, and dimensions (for arrays).

The expression can request additional functions if it contains a line that starts with '#import' followed by the Library name of the plug-in that defines the functions.