Version
Version | Functional Change |
---|---|
11.0 | Different from 10.0 in: 11.0 added interfaces including servletURL, serverURL, server, fineServletURL, and SessionMgr.getSessionID(). |
11.0.7 | Added description of FVS template interface. Applicable to users who have installed the FVS Dashboard Edit Mode plugin of version 1.8.0 and later. |
11.0.9 | The remoteEvaluate interface supported the FVS Dashboard Edit Mode plugin of version 1.15.0 and later. |
11.0.10 | showDialog and doHyperlinkByGet parameters supported JSON. |
Notice:
1. Application programming interfaces (API) mentioned in this article shall be used in the format of FR.xxx for general reports and dashboards (new version), and in the format of duchamp.xxx for FVS dashboard templates.
2. For some interfaces, the FVS template parameter is in JSON format, while for general reports and dashboards, the parameter is in string format. For details, see the interface introduction below.
servletURL
Attribute | servletURL | GET ServletURL |
---|---|---|
Parameter | - | - |
Returned value | string | Returns a string in a format like /webroot/decision/view/report |
Example | For general reports and dashboards: FR.servletURL; For FVS templates: duchamp.servletURL; | |
Application | - | |
Mobile terminal | Supported There is a difference between the return format of the mobile terminal and the PC terminal, such as /webroot/decision. |
serverURL
Attribute | servletURL | GET ServletURL |
---|---|---|
Parameter | - | - |
Returned value | string | Returns a string in a format like http://localhost:port |
Example | For general reports and dashboards:
For FVS templates: duchamp.serverURL; | |
Application | - | |
Mobile terminal | Not supported |
Server
Attribute | server | GET Server |
---|---|---|
Parameter | - | - |
Returned value | string | Returns a string in a format like http://localhost:port/webroot |
Example | For general reports and dashboards:
For FVS templates: duchamp.server; | |
Application | - | |
Mobile terminal | Not supported |
fineServletURL
Attribute | fineServletURL | GET fineServletURL |
---|---|---|
Parameter | - | - |
Returned value | string | Returns a string in a format like /webroot/decision |
Example | For general reports and dashboards:
For FVS templates: duchamp.fineServletURL; | |
Application | - | |
Mobile terminal | Not supported |
SessionMgr.getSessionID
Method | SessionMgr.getSessionID() | GET sessionId |
---|---|---|
Parameter | - | - |
Returned value | string | Returns a string in a format like 62a0f071-c2c6-4623-91c3-3d58c6265c19 |
Example | For general reports and dashboards:
For FVS templates: duchamp.SessionMgr.getSessionID(); | |
Application | Click the button to print the report sessionId. Click to download the FVS template. | |
Mobile terminal | Supported |
showDialog
General Reports and Dashboards
Method | showDialog(title, width, height, innerContent) | Open a dialog box |
---|---|---|
Parameter | title: string width: number height: number innerContent: iframe Note: In FineReport 11.0.10 and later versions, the parameters support JSON format, as shown below.{ title:string, width:number, height:number, innerContent:iframe } | title: title of the dialog box, string width: dialog width height: dialog height innerContent: dialog content, iframe tage. If you want to open a report in the project, you need to add an iframe tag first. |
Returned value | void | |
Example | Example 1: Open a dialog box with the title "Pop-up Window", width 600, height 400, where the content of the dialog box is "Hello World". For general reports and dashboards:
Example 2: Open a dialog box with the title "Region Sales Situation", width 700, height 500, where the content of the dialog box is the built-in template "GettingStarted.cpt". Note: Pay attention to avoid code format problems caused by line changes and modify the format when entering long codes in the designer, as shown below. For general reports and dashboards:
| |
Application | Click to button to open a dialog box with the title "Region Sales Situation", width 700, height 500, where the content of the dialog box is the built-in template "GettingStarted.cpt". For details, see JS implements data backfill after pop-up window. | |
Mobile terminal | Not supported |
FVS Templates
Method | showDialog( { title:string, width:number, height:number, innerContent:iframe } ) | Open a dialog box |
---|---|---|
Parameter | title:string width:number height:number innerContent:iframe | title: title of the dialog box, string width: dialog width height: dialog height innerContent: dialog content, iframe tage. If you want to open a report in the project, you need to add an iframe tag first. |
Returned value | string | |
Example | Example 1: Open a dialog box with the title "Pop-up Window", width 600, height 400, where the content of the dialog box is"Hello World".
Example 2: Open a dialog box with the title "Popup of Region Sales Situation", width 700, height 500, where the content of the dialog box is the built-in template "GettingStarted.cpt".
| |
Application | Open a dialog box with the title "Popup of Region Sales Situation", width 700, height 500, where the content of the dialog box is the built-in template "GettingStarted.cpt". Click to download the template. Click to open iframe dialog box.fvs | |
Mobile terminal | Not supported |
closeDialog
Method | closeDialog() | Close the dialog |
---|---|---|
Parameter | - | - |
Returned value | void | |
Example | For general reports and dashboards:
For FVS templates: duchamp.closeDialog(); | |
Application | Once you select the data, the dialog box will automatically close. For details, see JS implements data backfill after pop-up window. | |
Mobile terminal | Not supported |
doHyperlinkByGet
General Reports and Dashboards
Method | doHyperlinkByGet(url,config,target,feature) | Open a webpage using the GET method, on which you can establish parameter linkage and set page properties. |
---|---|---|
Parameter | URL: object config: object target: object feature: object Note: In FineReport 11.0.10 and later versions, the parameters support JSON format, as shown below.{ URL: object config: object target: object feature: object } | URL: URL or JSON hyperlink, required An example of supported absolute paths: http://192.168.100.1:8080/webroot/decision/view/report?viewlet=GettingStarted.cpt An example of supported relative paths: /webroot/decision/view/report?viewlet=GettingStarted.cpt config: The parameter to be linked. It can be omitted. target: The opening path of a hyperlink page. It can be omitted.
feature: The attribute of the hyperlink opening path. It can be omitted. Note: The target and feature parameters are not supported on mobile terminals. |
Returned value | void | |
Example | Open the built-in template GettingStarted.cpt and one report named "Region Sales Situation", where the parameter "East China" is linked, and set whether to display the parameter panel and open the parameter panel as a dialog if it is displayed, with the dialog width 700 and height 500:
| |
Application | Click the button to open a dialog with the title "Region Sales Situation", width 700, height 500, where the content of the dialog box is the sales data of East China. For details, see JS Implementation Dialog Box Open Hyperlink. | |
Mobile terminal | Supported |
FVS Templates
Method | doHyperlinkByGet( { url:object, para:object, target:object, feature:object } ) | Open a webpage using the GET method, on which you can establish parameter linkage and set page properties.
|
---|---|---|
Parameter | url:object para:object target:object feature:object
| URL: URL or JSON hyperlink, required. An example of supported absolute paths: http://192.168.100.1:8080/webroot/decision/view/report?viewlet=GettingStarted.cpt An example of supported relative paths: /webroot/decision/view/report?viewlet=GettingStarted.cpt para: The parameter to be linked. It can be omitted. target: The opening path of the hyperlink page. It can be omitted and it defaults to _dialog.
feature: The attribute of the hyperlink opening path. It can be omitted. |
Returned value | void | |
Example | Open the built-in template GettingStarted.cpt and one report named "Region Sales Situation", where the parameter "California" is linked, and set whether to display the parameter panel and open the parameter panel as a dialog if it is displayed, with the dialog width 700 and height 500:
| |
Application | Click the button to open a dialog with the title "Region Sales Situation", width 700, height 500, where the content of the dialog box is the sales data of California. Click to download the template. Use GET to open a dialog box.fvs | |
Mobile terminal | Not supported |
doHyperlinkByPost
General Reports and Dashboards
Method | doHyperlinkByPost(url,config,tar get,feature) | Open a webpage using the POST method, on which you can establish parameter linkage and set page properties. |
---|---|---|
Parameter | URL: object config: object target: object feature: object | URL: URL or JSON hyperlink, required. An example of supported absolute paths: http://192.168.100.1:8080/webroot/decision/view/report?viewlet=GettingStarted.cpt An example of supported relative paths: /webroot/decision/view/report?viewlet=GettingStarted.cpt config: The parameter to be linked. It can be omitted. target: The opening path of a hyperlink page. It can be omitted.
feature: The attribute of the hyperlink opening path. It can be omitted. Note: The target and feature parameters are not supported on mobile terminals. |
Returned value | void | |
Example | Open the built-in template GettingStarted.cpt and one report named "Region Sales Situation", where the parameter "East China" is linked, and set whether to display the parameter panel and open the parameter panel as a dialog if it is displayed, with the dialog width 700 and height 500:
| |
Application | Click the button to open a dialog with the title "Region Sales Situation", width 700, height 500, where the content of the dialog box is the sales data of East China. For details, see JS Implementation Dialog Box Open Hyperlink. | |
Mobile terminal | Supported |
FVS Templates
Method | doHyperlinkByPost( { url:object, config:object, target:object, feature:object } ) | Open a webpage using the POST method, on which you can establish parameter linkage and set page properties. |
---|---|---|
Parameter | URL: object config: object target: object feature: object | URL: URL or JSON hyperlink, required. An example of supported absolute paths: http://192.168.100.1:8080/webroot/decision/view/report?viewlet=GettingStarted.cpt An example of supported relative paths: /webroot/decision/view/report?viewlet=GettingStarted.cpt config: The parameter to be linked. It can be omitted. target: The opening path of the hyperlink page. It can be omitted and it defaults to _dialog.
feature: The attribute of the hyperlink opening path. It can be omitted. |
Returned value | void | |
Example | Open the built-in template GettingStarted.cpt and one report named "Region Sales Situation", where the parameter "California" is linked, and set whether to display the parameter panel and open the parameter panel as a dialog if it is displayed, with the dialog width 700 and height 500:
| |
Application | Click the button to open a dialog with the title "Region Sales Situation", width 700, height 500, where the content of the dialog box is the sales data of California. Click to download the template. Use POST to open a dialog box.fvs | |
Mobile terminal | Not supported |
doURLPrint
Method | doURLPrint(config) | Call up the printing tool to print reports |
---|---|---|
Parameter | config: object | config: Print parameter. For details about the parameter format, see doURLPrint. |
Returned value | void | |
Example | See: doURLPrint. | |
Application | Customize the print button to print reports using "Zero Client Printing". | |
Mobile terminal | Not supported |
Msg
Method | Msg | FineReport has built-in a message box with a unified style that can replace the alert, confirm, prompt, and toast pop-up boxes in Windows. |
---|---|---|
Parameter | config: object | It shall be used together with other methods. For details, see Msg. |
Returned value | void | |
Example | See: Msg. | |
Application | See: Msg. | |
Mobile terminal | Supported |
remoteEvaluate
Method | remoteEvaluate("formula") | To execute FR built-in formulas to get the calculation result. Note: 1. The remoteEvaluate(String) interface does not support tablename.select function. 2. The remoteEvaluate(String) interface is not supported by web pages. |
---|---|---|
Parameter | formula: String | Formula |
Returned value | object | |
Example | Call the sum function in FineReport for general reports and dashboards to sum A1 and A2.
Call the CONCATENATE function in FineReport to link strings together for general reports and dashboards.
For FVS templates (V1.15.0 and later versions are supported): duchamp.remoteEvaluate("sum(A1,A2)"); | |
Application | - | |
Mobile terminal | Supported Note: Starting from version 9.0, the mobile App no longer supports FR.remoteEvaluate(formula), and it will report an error saying "synchronous http requests are not supported". |
Notes:
The use of the remoteEvaluate interface may allow attackers to perform operations on the database such as adding, deleting, modifying, and querying, posing a security risk that is equivalent to allowing remote execution.
Therefore, a Forbid Script to Call Formula function has been added to the decision-making platform and is enabled by default. If you use the remoteEvaluate interface and enable this function, a prompt message will pop up during the preview saying "This call has security risks. If you need to use it, please modify the script call formula restrictions in Security Management", as shown below.
If you do not want this popup message, you need to disable the function in the platform. For details, see Security Protection Settings.
jsonEncode
Method | jsonEncode(code) | Encode the string using jsonEncode |
---|---|---|
Parameter | code:String | String to be encoded, required |
Returned value | String | |
Example | Encode the report path using jsonEncode. For general reports and dashboards:
For FVS templates: duchamp.jsonEncode("/webroot/decision/view/report?viewlet=GettingStarted.cpt"); | |
Application | - | |
Mobile terminal | Not supported |
jsonDecode
Method | jsonDecode(jsonEncode) | Decode a string that has been encoded using jsonEncode |
---|---|---|
Parameter | code:String | String to be encoded, required |
Returned value | String | |
Example | Decode the report path that has been encoded using jsonEncode. For general reports and dashboards:
For FVS templates:
| |
Application | - | |
Mobile terminal | Not supported |
ajax
Method | ajax(options) | It is the jQuery.ajax() function after encapsulation, in which the data parameter is processed with Chinese, Japanese, and Korean encoding and can be called in any place where JS can be used through FR.ajax(options). |
---|---|---|
Parameter | options | Ajax parameter in JSON format, see ajax. |
Returned value | void | |
Example | See ajax. | |
Application | See ajax. | |
Mobile terminal | Supported |
isEmpty
Method | isEmpty(object) | Check if the object is empty. |
---|---|---|
Parameter | Object:Object | Object |
Returned value | Boolean | Whether it is empty or not. true: Yes false: No |
Example | 1) Check if the string control named text0 exists. For general reports and dashboards (widgets in the parameter panel): var a = FR.isEmpty(_g().getParameterContainer().getWidgetByName("text0")); For FVS templates: var a = duchamp.isEmpty(duchamp.getWidgetByName("text0")); 2) Check if the string control named text0 is empty. For general reports and dashboards (widgets in the parameter panel):
For FVS templates:
| |
Application | - | |
Mobile terminal | Not supported |
isArray
Method | isArray(object) | Check if the object is an array |
---|---|---|
Parameter | Object:Object | Object |
Returned value | Boolean | Whether it is empty or not. true: Yes false: No |
Example | Define an array and check if it is an array. For general reports and dashboards:
For FVS templates:
| |
Application | - | |
Mobile terminal | Not supported |
cellStr2ColumnRow
Method | cellStr2ColumnRow(cell) | Get row and column indexes based on the cell number |
---|---|---|
Parameter | cell | Cell number |
Returned value | {col:colindex, row:rowindex} | Row and column indexes in JSON format col: Column index, starting from 0 row: Row index, starting from 0 |
Example | Example 1: Return the row and column information of cell A1 in general reports or dashboards.
Example 2: Print the row number of cell A1 in general reports or dashboards.
Example 3: Print the row and column number of a cell in FVS templates. v
| |
Application | For general reports: Click the button to print the row number of cell A1. For FVS templates: Click the button to print the row and column number of cell A3. Click to download the template. Print cell row and column information.fvs | |
Mobile terminal | Supported |
columnRow2CellStr
Method | columnRow2CellStr({col:colindex, row: rowindex}) | Get cell number based on row and column number |
---|---|---|
Parameter | {col:colindex, row:rowindex} | Row and column indexes in JSON format |
Returned value | cell | Cell number |
Example | Example 1: Get the cell number of the cell in general reports or dashboards with row index 3 and column index 1.
Example 2: Print the cell number of the cell in general reports or dashboards with row index 3 and column index 1.
Example 3: Print the cell number of the cell in FVS templates with row index 3 and column index 1.
| |
Application | For general reports: Row index 3, column index 1 cell number is B4 For FVS templates: Print a cell number whose row index is 3 and column index is 1. Click to download the template. Get cell number with column number.fvs | |
Mobile terminal | Not supported |