Global Function

<< Click to Display Table of Contents >>

Current:  Script 

Global Function

Previous pageReturn to chapter overviewNext page

The global function means that a function defined outside the product can be called by the product and can be called repeatedly. For example, in many reports may use the same function, if you need to redefine the function in each report, it is too complicated, so the function is defined on the outside of the product, only need to call when used It can be used.

Features:

Need to add in bi.properties: script.functions.path=cmnetFunctions. Where cmnetFunctions is the name of the added file.

For example: create a new file called test.java, the content is:

function testAdd(a,b) { 

return a + b;

}

Configured in bi.properties: script.functions.path=test.java

Then create a new text component in the dashboard and select the script in the right panel settings. In the script, enter: Text1.data = testAdd("Hello ","Yonghong"). As shown below:

script45

The effect shown is :

script46