# Servoy Jasper Reports

(plugins.jasperReports)

## Overview

This class serves as the primary implementation for managing JasperReports in a Servoy application. It provides functionalities for report generation, data source handling, file operations, and export customization. Using these, developers can seamlessly integrate JasperReports into Servoy projects for dynamic report creation and management.

## Key Functionalities

The class facilitates running reports with various data sources and input types, including databases, XML, and CSV. Developers can define input and output parameters, customize locales, and specify the output format using predefined constants.

File operations are supported for reading, writing, and deleting report files on the server. Reports can be compiled from `.jrxml` files to `.jasper` format for optimized performance. Additionally, the class includes methods for retrieving available reports, merging multiple reports, and accessing or modifying report parameters.

The class also supports viewing, printing, and exporting reports in multiple formats such as PDF, HTML, Excel, and XML. Export options include setting custom parameters for advanced use cases, like embedding metadata or adjusting resource paths for specific output types.

Advanced features include handling viewer configurations, moving table-of-content pages, and merging reports with consistent styles and orientations. Developers can also use locale-based i18n integration to produce reports in different languages.

For more informations on how to use it and other useful tips related to the plugin, see <https://github.com/Servoy/servoy\\_jasperreports/wiki>.

## **Returned Types**

[INPUT\_TYPE](/guides/develop/programming-guide/jasperreports/input_type.md),[OUTPUT\_FORMAT](/guides/develop/programming-guide/jasperreports/output_format.md),[JR\_SVY\_VIEWER\_DISPLAY\_MODE](/guides/develop/programming-guide/jasperreports/jr_svy_viewer_display_mode.md),

## Properties Summarized

| Type                                                     | Name                                                  | Summary                                                                                                                                     |
| -------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [pluginVersion](#pluginversion)                       | Get the version of the Servoy JasperReports Plugin.                                                                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [relativeExtraDirectories](#relativeextradirectories) | Property for retrieving and setting the paths to the extra resources directories.                                                           |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [relativeReportsDirectory](#relativereportsdirectory) | Property for retrieving and setting the path to the reports directory, set by the current client, relative to the server reports directory. |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)   | [viewerExportFormats](#viewerexportformats)           | Property used in order to get or set the Jasper Viewer's export formats.                                                                    |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [viewerIconURL](#viewericonurl)                       | Sets or gets the Jasper Viewer's icon URL.                                                                                                  |
| [String](/reference/servoycore/dev-api/js-lib/string.md) | [viewerTitle](#viewertitle)                           | Sets or gets the Jasper Viewer's title text.                                                                                                |

## Methods Summarized

| Type                                                                     | Name                                                                                                                                                                                                                                                                   | Summary                                                                                             |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [compileReport(report)](#compilereport-report)                                                                                                                                                                                                                         | Compile a Jasper Reports .                                                                          |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [compileReport(report, destination)](#compilereport-report-destination)                                                                                                                                                                                                | Compile a Jasper Reports .                                                                          |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [deleteFileFromReportsDir(fileName)](#deletefilefromreportsdir-filename)                                                                                                                                                                                               | Delete a report file from the Server.                                                               |
| [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) | [getReportParameters(report)](#getreportparameters-report)                                                                                                                                                                                                             | Retrieve a JSDataSet with the report parameters, except the system defined ones.                    |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getReports()](#getreports)                                                                                                                                                                                                                                            | Retrieve a String array of available reports, based on the reports directory.                       |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getReports(filter)](#getreports-filter)                                                                                                                                                                                                                               | Retrieve a String array of available reports, based on the reports directory.                       |
| [Object](/reference/servoycore/dev-api/js-lib/object.md)                 | [mergeJasperPrint(printList, orientation, outputType, outputOptions, localeString)](#mergejasperprint-printlist-orientation-outputtype-outputoptions-localestring)                                                                                                     | Function to merge two or more reports into a single report file.                                    |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [readFileFromReportsDir(fileName)](#readfilefromreportsdir-filename)                                                                                                                                                                                                   | Retrieve a report file from the Server.                                                             |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [runReport(reportDataSource, report, outputOptions, outputType, parameters)](#runreport-reportdatasource-report-outputoptions-outputtype-parameters)                                                                                                                   | This method runs a specified (client) report according to the output format, parameters and locale. |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [runReport(reportDataSource, report, outputOptions, outputType, parameters, localeString)](#runreport-reportdatasource-report-outputoptions-outputtype-parameters-localestring)                                                                                        | This method runs a specified (client) report according to the output format, parameters and locale. |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [runReport(reportDataSource, report, outputOptions, outputType, parameters, localeString, moveTableOfContent)](#runreport-reportdatasource-report-outputoptions-outputtype-parameters-localestring-movetableofcontent)                                                 | This method runs a specified (client) report according to the output format, parameters and locale. |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [runReport(inputType, reportDataSource, inputOptions, report, outputOptions, outputType, parameters)](#runreport-inputtype-reportdatasource-inputoptions-report-outputoptions-outputtype-parameters)                                                                   | This method runs a specified (client) report according to the output format, parameters and locale. |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [runReport(inputType, reportDataSource, inputOptions, report, outputOptions, outputType, parameters, localeString)](#runreport-inputtype-reportdatasource-inputoptions-report-outputoptions-outputtype-parameters-localestring)                                        | This method runs a specified (client) report according to the output format, parameters and locale. |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [runReport(inputType, reportDataSource, inputOptions, report, outputOptions, outputType, parameters, localeString, moveTableOfContent)](#runreport-inputtype-reportdatasource-inputoptions-report-outputoptions-outputtype-parameters-localestring-movetableofcontent) | This method runs a specified (client) report according to the output format, parameters and locale. |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [writeFileToReportsDir(fileName, obj)](#writefiletoreportsdir-filename-obj)                                                                                                                                                                                            | Store a reportFile on the Server.                                                                   |

## Properties Detailed

### pluginVersion

Get the version of the Servoy JasperReports Plugin.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) the plugin's version

**Sample**

```js
application.output(plugins.jasperReports.pluginVersion);
```

### relativeExtraDirectories

Property for retrieving and setting the paths to the extra resources directories. The paths are set per client\
and are relative to the server corresponding directories setting.

By default the value is read from the Admin Page: Server Plugins - the directories.jasper.extra property. If the\
client modifies the default property, this value will be used instead of the default one for the whole client\
session and only for this client. Each client session has it's own extraDirectories value.

NOTE: Extra directories are not searched recursively.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) the path to the extra directories relative to the server side set location

**Sample**

```js
//setting the extra directories, relative to the server side location
plugins.jasperReports.relativeExtraDirectories = "extraDir1,extraDir2";
```

### relativeReportsDirectory

Property for retrieving and setting the path to the reports directory, set by the current client, relative to the\
server reports directory.

By default the value is read from the admin page Server Plugins, the directory.jasper.report property. If no value\
has been set in the admin page for the report directory, the default location will be set to /path\_to\_install/application\_server/server/reports.\
A client is only able to set a path relative to the server report directory. If the client modifies this property, its value\
will be used instead of the default one, for the whole client session and only for this client. Each client\
session has it's own relativeReportDirectory value.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) the location of the reports directory, relative to the server set path

**Sample**

```js
plugins.jasperReports.relativeReportsDirectory = "/myReportsLocation";
```

### viewerExportFormats

Property used in order to get or set the Jasper Viewer's export formats.

**Type**\
[Array](/reference/servoycore/dev-api/js-lib/array.md) the list of desired export formats; the first one will be the default export format.

**Sample**

```js
var defaultExportFormats = plugins.jasperReports.viewerExportFormats;
application.output(defaultExportFormats);

// use the default export constants of the plugin, of the OUTPUT_FORMAT constants node; 
// the following formats are available for setting the viewer export formats: 
// PDF, JRPRINT, RTF, ODT, HTML, XLS_1_SHEET, XLS, CSV, XML
// and there is an extra Xml with Embedded Images export type available for the Viewer, denoted by 'xml_embd_img'
// the first export format in the list will be the default one displayed in the Save dialog of the Viewer
plugins.jasperReports.viewerExportFormats = [OUTPUT_FORMAT.PDF, OUTPUT_FORMAT.RTF, 'xml_embd_img'];
```

### viewerIconURL

Sets or gets the Jasper Viewer's icon URL.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
plugins.jasperReports.viewerIconURL = 'myIcon.jpg'
```

### viewerTitle

Sets or gets the Jasper Viewer's title text.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
plugins.jasperReports.viewerTitle = 'My Title'
```

## Methods Detailed

### compileReport(report)

Compile a Jasper Reports .jrxml file to a .jasper file.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the .jrxml jasper report file

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) the compiled jasper report file

**Sample**

```js
// Compile the .jrxml jasper report file to a .jasper file. The name of the compiled file is given by the report name 
// The report name as an absolute path. Results the compiled c:\\temp\\samplereport.jasper file. 
var success = plugins.jasperReports.compileReport('c:\\\\temp\\\\samplereport.jrxml'); 
// The report name as a relative path. The file will be searched relative to the ReportDirectory. 
var success = plugins.jasperReports.compileReport('myCustomerReport1.jrxml'); 
var success = plugins.jasperReports.compileReport( '\\\\subdir\\\\myCustomerReport2.jrxml'); 
// To specify a different destination file than the original filaname, the second parameter can be incouded. 
// If it is relative, the file will be created relative to the ReportDirectory. 
var success = plugins.jasperReports.compileReport('c:\\\\temp\\\\samplereport.jrxml', 'd:\\\\temp2\\\\destreport.jasper');
```

### compileReport(report, destination)

Compile a Jasper Reports .jrxml file to a .jasper file.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the .jrxml jasper report file
* [String](/reference/servoycore/dev-api/js-lib/string.md) **destination** the destination file for the compiled report

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) the compiled jasper report file

**Sample**

```js
// Compile the .jrxml jasper report file to a .jasper file. The name of the compiled file is given by the report name 
// The report name as an absolute path. Results the compiled c:\\temp\\samplereport.jasper file. 
var success = plugins.jasperReports.compileReport('c:\\\\temp\\\\samplereport.jrxml'); 
// The report name as a relative path. The file will be searched relative to the ReportDirectory. 
var success = plugins.jasperReports.compileReport('myCustomerReport1.jrxml'); 
var success = plugins.jasperReports.compileReport( '\\\\subdir\\\\myCustomerReport2.jrxml'); 
// To specify a different destination file than the original filaname, the second parameter can be incouded. 
// If it is relative, the file will be created relative to the ReportDirectory. 
var success = plugins.jasperReports.compileReport('c:\\\\temp\\\\samplereport.jrxml', 'd:\\\\temp2\\\\destreport.jasper');
```

### deleteFileFromReportsDir(fileName)

Delete a report file from the Server.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **fileName** the name of the report file to delete

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the file was successfully deleted, false otherwise

**Sample**

```js
var reportFile2Delete = 'myCustomerReport.jrxml'; 
plugins.jasperReports.deleteFileFromReportsDir(reportFile2Delete);
```

### getReportParameters(report)

Retrieve a JSDataSet with the report parameters, except the system defined ones.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the name of the report file to get the parameters for

**Returns:** [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) the JSDataSet with the report parameters

**Sample**

```js
var ds = plugins.jasperReports.getReportParameters('sample.jrxml'); 
var csv = ds.getAsText(',','\\n','\"',true); 
application.output(csv);
```

### getReports()

Retrieve a String array of available reports, based on the reports directory.

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the String array of available reports

**Sample**

```js
// COMPILED - only compiled reports, NONCOMPILED - only non-compiled reports 
// No parameter returns all the reports 
var result = plugins.jasperReports.getReports('NONCOMPILED'); 
application.output(result[0]); 
//using a string as the search filter 
//var result = plugins.jasperReports.getReports('*criteria*'); 
//for(var i=0; i<result.length; i++) 
//application.output(result[i]);
```

### getReports(filter)

Retrieve a String array of available reports, based on the reports directory.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **filter** the string to be used as a search filter

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the String array of available reports

**Sample**

```js
// COMPILED - only compiled reports, NONCOMPILED - only non-compiled reports 
// No parameter returns all the reports 
var result = plugins.jasperReports.getReports('NONCOMPILED'); 
application.output(result[0]); 
//using a string as the search filter 
//var result = plugins.jasperReports.getReports('*criteria*'); 
//for(var i=0; i<result.length; i++) 
//application.output(result[i]);
```

### mergeJasperPrint(printList, orientation, outputType, outputOptions, localeString)

Function to merge two or more reports into a single report file.\
The reports to merge must have been previously exported as JRPRINTs.

**Parameters**

* [Array](/reference/servoycore/dev-api/js-lib/array.md) **printList** the list of reports to merge; the objects in the list must be jasperPrint objects (or reports exported as jasper print)
* [String](/reference/servoycore/dev-api/js-lib/string.md) **orientation** the orientation of the result report
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output type of the result report
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output options of the report, as provided for the runReport function
* [String](/reference/servoycore/dev-api/js-lib/string.md) **localeString** localeString the string which specifies the locale

**Returns:** [Object](/reference/servoycore/dev-api/js-lib/object.md) the result report as an Object

**Sample**

```js
// Merge two report files into a single output report file. Note that the list of reports to merge must jasper print exported reports.
// var $jp1 = plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate', 'report1.jrxml', null, plugins.jasperReports.OUTPUT_FORMAT.JRPRINT, $parameters, $locale);
// var $jp2 = plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate', 'report2.jrxml', null, plugins.jasperReports.OUTPUT_FORMAT.JRPRINT, $parameters, $locale);
// var $list = new java.util.ArrayList();
// $list.add($jp1);
// $list.add($jp2);
// var $jasper_result = plugins.jasperReports.mergeJasperPrint($list, 'landscape', plugins.jasperReports.OUTPUT_FORMAT.VIEW, null, $locale);
```

### readFileFromReportsDir(fileName)

Retrieve a report file from the Server.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **fileName** the name of the file to read from the reports directory

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the report file retrieved as a byte array

**Sample**

```js
var reportFileArray = plugins.jasperReports.readFileFromReportsDir('myCustomerReport.jasper'); 
// Subfolders can be used to read files. 
var reportFileArray = plugins.jasperReports.readFileFromReportsDir('\\\\subdir\\\\myCustomerReport.jasper');
```

### runReport(reportDataSource, report, outputOptions, outputType, parameters)

This method runs a specified (client) report according to the output format, parameters and locale. If using a table of contents and if needed, the table of contents can be moved to a specified page. Please refer to the sample code for more details.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **reportDataSource** the server name or foundset to run the report on
* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the report file (relative to the reports directory)
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output file (must specify an absolute path) or null if not needed
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output format; use the constants node for available output formats
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **parameters** a parameter map to be used when running the report

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the generated reported as a byte array

**Sample**

```js
// The method runs a client report specified by the second parameter acording to the output format. 
// The report can be a compiled jasper file or a jrxml file from a relative path to the reportDirectory or an absolute one. 
// To view the result of the customers report in the Jasper Report viewer in the SmartClient or as PDF in the WebClient. 
// Note: the parameters argument is used to send additional parameters into the report. For example: 
// {pcustomerid: forms.customers.customer_id} to send just 1 parameter called pcustomerid, which contains the value 
// of dataprovider customer_id in the selected record on the customers form 
// The parameters argument is an Object, which can be instantiated in two ways: 
// var o = new Object(); 
// o.pcustomerid = forms.customers.customer_id; 
// or: 
// var o = {pcustomerid: forms.customers.customer_id}; 
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
ds = foundset.getDataSource(); 
var d = ds.split('/); 
var myServer = d[1];
plugins.jasperReports.runReport(myServer, 'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id});

// To request a report in a different Language than the current language of the client, it's possible to specify a Locale string
// as the locale argument. For example: 'en_US' or 'es_ES' or 'nl_NL' 
// When the locale argument is not specified, the report will be in the current langauge of the Client 
// i18n keys of Servoy can be used inside Jasper Reports using the $R{i18n-key} notation 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id},'nl_NL');

// To print the result of the customers report in the SmartClient (to a specified printer), 
// the outputType should be specified as 'print' (OUTPUT_FORMAT.PRINT). 
// The third parameter can contain the name of the printer to  which the report needs to be printed 
// or can contain true (boolean value) to show a print dialog before printing. 
// If false (boolean value) or null is specified, it will print without showing the print dialog to the default printer. 
// Note: In the WebClient a PDF will be pushed to the Client when the outputType is specified as 'print' (OUTPUT_FORMAT.PRINT). 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.PRINT,{pcustomerid: forms.customers.customer_id});

// To generate the report in the specified output format and save the result to 'myReport.html' in the root of the C drive: 
// Supported output formats are: xhtml, html, pdf, excel( or xls), xls_1_sheet (1 page per sheet), xlsx, ods, rtf, txt, csv, odt, docx, jrprint and xml. 
// These are available as constants in the OUTPUT_FORMAT node of the plugin's tree. 
// Note: in the WebClient, the file will be saved serverside, so the specified path needs to be valid serverside 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xhtml',OUTPUT_FORMAT.XHTML,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.html',OUTPUT_FORMAT.HTML,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.pdf',OUTPUT_FORMAT.PDF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.rtf',OUTPUT_FORMAT.RTF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.jrprint',OUTPUT_FORMAT.JRPRINT,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.txt',OUTPUT_FORMAT.TXT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.csv',OUTPUT_FORMAT.CSV,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.odt',OUTPUT_FORMAT.ODT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.docx',OUTPUT_FORMAT.DOCX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xlsx',OUTPUT_FORMAT.XLSX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS_1_SHEET,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.ods',OUTPUT_FORMAT.ODS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id});

// Jasper Reports supports queries with IN operators through the following notation: 
// X${IN,columnName,parameterName} like 'select * from customers where X$(IN,customer_id,pcustomeridlist) 
// When using this notation, the pcustomeridlist parameter needs to contain one or more values in the following way:
//var idlist = new Array(); 
//idlist[0] = 1; 
//idlist[1] = 26 ;
//plugins.jasperReports.jasperReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomeridlist: idlist}); 

//The return value is a byte array with the content of the file generated that can be further used. 
//var res = plugins.jasperReports.runReport(myServer,'samplereport.jrxml', null, OUTPUT_FORMAT.PDF, null);
//plugins.file.writeFile('e:\\\\sample.pdf', res);

// In order to run the report and move the table of contents(marked with the string: \"HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS\") 
// to the Insert page, which has to be identified by the string: \"HIDDEN TEXT TO MARK THE INSERT PAGE\" 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id}, null,true);

// Pass exporter parameters to the export process in runReport 
//var params = new Object();
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.title"] =  "Test title"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.author" ] = "Test Author";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.creator"] =  "Test creator"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.keywords" ] = "Test keywords";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.subject"] =  "Test subject";
//var r = plugins.jasperReports.runReport("myServer","someReport.jrxml","path/to/someReportExported.pdf",OUTPUT_FORMAT.PDF,params);

// Using an XML/CSV file as the datasource of the report.
//var $parameters = null; //...
//var $repfile = 'report.jrxml';
//var $xmlDataCombined = plugins.file.readTXTFile('/path/to/datasource.xml');
//var $locale = 'en';
//plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate/on', $repfile, null, OUTPUT_FORMAT.VIEW, $parameters, null)
```

### runReport(reportDataSource, report, outputOptions, outputType, parameters, localeString)

This method runs a specified (client) report according to the output format, parameters and locale. If using a table of contents and if needed, the table of contents can be moved to a specified page. Please refer to the sample code for more details.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **reportDataSource** the server name or foundset to run the report on
* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the report file (relative to the reports directory)
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output file (must specify an absolute path) or null if not needed
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output format; use the constants node for available output formats
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **parameters** a parameter map to be used when running the report
* [String](/reference/servoycore/dev-api/js-lib/string.md) **localeString** the string which specifies the locale

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the generated reported as a byte array

**Sample**

```js
// The method runs a client report specified by the second parameter acording to the output format. 
// The report can be a compiled jasper file or a jrxml file from a relative path to the reportDirectory or an absolute one. 
// To view the result of the customers report in the Jasper Report viewer in the SmartClient or as PDF in the WebClient. 
// Note: the parameters argument is used to send additional parameters into the report. For example: 
// {pcustomerid: forms.customers.customer_id} to send just 1 parameter called pcustomerid, which contains the value 
// of dataprovider customer_id in the selected record on the customers form 
// The parameters argument is an Object, which can be instantiated in two ways: 
// var o = new Object(); 
// o.pcustomerid = forms.customers.customer_id; 
// or: 
// var o = {pcustomerid: forms.customers.customer_id}; 
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
ds = foundset.getDataSource(); 
var d = ds.split('/); 
var myServer = d[1];
plugins.jasperReports.runReport(myServer, 'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id});

// To request a report in a different Language than the current language of the client, it's possible to specify a Locale string
// as the locale argument. For example: 'en_US' or 'es_ES' or 'nl_NL' 
// When the locale argument is not specified, the report will be in the current langauge of the Client 
// i18n keys of Servoy can be used inside Jasper Reports using the $R{i18n-key} notation 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id},'nl_NL');

// To print the result of the customers report in the SmartClient (to a specified printer), 
// the outputType should be specified as 'print' (OUTPUT_FORMAT.PRINT). 
// The third parameter can contain the name of the printer to  which the report needs to be printed 
// or can contain true (boolean value) to show a print dialog before printing. 
// If false (boolean value) or null is specified, it will print without showing the print dialog to the default printer. 
// Note: In the WebClient a PDF will be pushed to the Client when the outputType is specified as 'print' (OUTPUT_FORMAT.PRINT). 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.PRINT,{pcustomerid: forms.customers.customer_id});

// To generate the report in the specified output format and save the result to 'myReport.html' in the root of the C drive: 
// Supported output formats are: xhtml, html, pdf, excel( or xls), xls_1_sheet (1 page per sheet), xlsx, ods, rtf, txt, csv, odt, docx, jrprint and xml. 
// These are available as constants in the OUTPUT_FORMAT node of the plugin's tree. 
// Note: in the WebClient, the file will be saved serverside, so the specified path needs to be valid serverside 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xhtml',OUTPUT_FORMAT.XHTML,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.html',OUTPUT_FORMAT.HTML,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.pdf',OUTPUT_FORMAT.PDF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.rtf',OUTPUT_FORMAT.RTF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.jrprint',OUTPUT_FORMAT.JRPRINT,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.txt',OUTPUT_FORMAT.TXT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.csv',OUTPUT_FORMAT.CSV,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.odt',OUTPUT_FORMAT.ODT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.docx',OUTPUT_FORMAT.DOCX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xlsx',OUTPUT_FORMAT.XLSX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS_1_SHEET,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.ods',OUTPUT_FORMAT.ODS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id});

// Jasper Reports supports queries with IN operators through the following notation: 
// X${IN,columnName,parameterName} like 'select * from customers where X$(IN,customer_id,pcustomeridlist) 
// When using this notation, the pcustomeridlist parameter needs to contain one or more values in the following way:
//var idlist = new Array(); 
//idlist[0] = 1; 
//idlist[1] = 26 ;
//plugins.jasperReports.jasperReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomeridlist: idlist}); 

//The return value is a byte array with the content of the file generated that can be further used. 
//var res = plugins.jasperReports.runReport(myServer,'samplereport.jrxml', null, OUTPUT_FORMAT.PDF, null);
//plugins.file.writeFile('e:\\\\sample.pdf', res);

// In order to run the report and move the table of contents(marked with the string: \"HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS\") 
// to the Insert page, which has to be identified by the string: \"HIDDEN TEXT TO MARK THE INSERT PAGE\" 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id}, null,true);

// Pass exporter parameters to the export process in runReport 
//var params = new Object();
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.title"] =  "Test title"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.author" ] = "Test Author";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.creator"] =  "Test creator"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.keywords" ] = "Test keywords";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.subject"] =  "Test subject";
//var r = plugins.jasperReports.runReport("myServer","someReport.jrxml","path/to/someReportExported.pdf",OUTPUT_FORMAT.PDF,params);

// Using an XML/CSV file as the datasource of the report.
//var $parameters = null; //...
//var $repfile = 'report.jrxml';
//var $xmlDataCombined = plugins.file.readTXTFile('/path/to/datasource.xml');
//var $locale = 'en';
//plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate/on', $repfile, null, OUTPUT_FORMAT.VIEW, $parameters, null)
```

### runReport(reportDataSource, report, outputOptions, outputType, parameters, localeString, moveTableOfContent)

This method runs a specified (client) report according to the output format, parameters and locale. If using a table of contents and if needed, the table of contents can be moved to a specified page. Please refer to the sample code for more details.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **reportDataSource** the server name or foundset to run the report on
* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the report file (relative to the reports directory)
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output file (must specify an absolute path) or null if not needed
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output format; use the constants node for available output formats
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **parameters** a parameter map to be used when running the report
* [String](/reference/servoycore/dev-api/js-lib/string.md) **localeString** the string which specifies the locale
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **moveTableOfContent** true in order to move the table of contents, false otherwise

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the generated reported as a byte array

**Sample**

```js
// The method runs a client report specified by the second parameter acording to the output format. 
// The report can be a compiled jasper file or a jrxml file from a relative path to the reportDirectory or an absolute one. 
// To view the result of the customers report in the Jasper Report viewer in the SmartClient or as PDF in the WebClient. 
// Note: the parameters argument is used to send additional parameters into the report. For example: 
// {pcustomerid: forms.customers.customer_id} to send just 1 parameter called pcustomerid, which contains the value 
// of dataprovider customer_id in the selected record on the customers form 
// The parameters argument is an Object, which can be instantiated in two ways: 
// var o = new Object(); 
// o.pcustomerid = forms.customers.customer_id; 
// or: 
// var o = {pcustomerid: forms.customers.customer_id}; 
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
ds = foundset.getDataSource(); 
var d = ds.split('/); 
var myServer = d[1];
plugins.jasperReports.runReport(myServer, 'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id});

// To request a report in a different Language than the current language of the client, it's possible to specify a Locale string
// as the locale argument. For example: 'en_US' or 'es_ES' or 'nl_NL' 
// When the locale argument is not specified, the report will be in the current langauge of the Client 
// i18n keys of Servoy can be used inside Jasper Reports using the $R{i18n-key} notation 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id},'nl_NL');

// To print the result of the customers report in the SmartClient (to a specified printer), 
// the outputType should be specified as 'print' (OUTPUT_FORMAT.PRINT). 
// The third parameter can contain the name of the printer to  which the report needs to be printed 
// or can contain true (boolean value) to show a print dialog before printing. 
// If false (boolean value) or null is specified, it will print without showing the print dialog to the default printer. 
// Note: In the WebClient a PDF will be pushed to the Client when the outputType is specified as 'print' (OUTPUT_FORMAT.PRINT). 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.PRINT,{pcustomerid: forms.customers.customer_id});

// To generate the report in the specified output format and save the result to 'myReport.html' in the root of the C drive: 
// Supported output formats are: xhtml, html, pdf, excel( or xls), xls_1_sheet (1 page per sheet), xlsx, ods, rtf, txt, csv, odt, docx, jrprint and xml. 
// These are available as constants in the OUTPUT_FORMAT node of the plugin's tree. 
// Note: in the WebClient, the file will be saved serverside, so the specified path needs to be valid serverside 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xhtml',OUTPUT_FORMAT.XHTML,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.html',OUTPUT_FORMAT.HTML,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.pdf',OUTPUT_FORMAT.PDF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.rtf',OUTPUT_FORMAT.RTF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.jrprint',OUTPUT_FORMAT.JRPRINT,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.txt',OUTPUT_FORMAT.TXT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.csv',OUTPUT_FORMAT.CSV,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.odt',OUTPUT_FORMAT.ODT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.docx',OUTPUT_FORMAT.DOCX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xlsx',OUTPUT_FORMAT.XLSX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS_1_SHEET,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.ods',OUTPUT_FORMAT.ODS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id});

// Jasper Reports supports queries with IN operators through the following notation: 
// X${IN,columnName,parameterName} like 'select * from customers where X$(IN,customer_id,pcustomeridlist) 
// When using this notation, the pcustomeridlist parameter needs to contain one or more values in the following way:
//var idlist = new Array(); 
//idlist[0] = 1; 
//idlist[1] = 26 ;
//plugins.jasperReports.jasperReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomeridlist: idlist}); 

//The return value is a byte array with the content of the file generated that can be further used. 
//var res = plugins.jasperReports.runReport(myServer,'samplereport.jrxml', null, OUTPUT_FORMAT.PDF, null);
//plugins.file.writeFile('e:\\\\sample.pdf', res);

// In order to run the report and move the table of contents(marked with the string: \"HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS\") 
// to the Insert page, which has to be identified by the string: \"HIDDEN TEXT TO MARK THE INSERT PAGE\" 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id}, null,true);

// Pass exporter parameters to the export process in runReport 
//var params = new Object();
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.title"] =  "Test title"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.author" ] = "Test Author";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.creator"] =  "Test creator"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.keywords" ] = "Test keywords";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.subject"] =  "Test subject";
//var r = plugins.jasperReports.runReport("myServer","someReport.jrxml","path/to/someReportExported.pdf",OUTPUT_FORMAT.PDF,params);

// Using an XML/CSV file as the datasource of the report.
//var $parameters = null; //...
//var $repfile = 'report.jrxml';
//var $xmlDataCombined = plugins.file.readTXTFile('/path/to/datasource.xml');
//var $locale = 'en';
//plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate/on', $repfile, null, OUTPUT_FORMAT.VIEW, $parameters, null)
```

### runReport(inputType, reportDataSource, inputOptions, report, outputOptions, outputType, parameters)

This method runs a specified (client) report according to the output format, parameters and locale. If using a table of contents and if needed, the table of contents can be moved to a specified page. Please refer to the sample code for more details.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **inputType** the type of the datasource, as one of the constants in INPUT\_TYPE
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **reportDataSource** the server name or foundset to run the report on
* [String](/reference/servoycore/dev-api/js-lib/string.md) **inputOptions** additional input options (e.g. which node to iterate in the xml datasource document)
* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the report file (relative to the reports directory)
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output file (must specify an absolute path) or null if not needed
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output format; use the constants node for available output formats
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **parameters** a parameter map to be used when running the report

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the generated reported as a byte array

**Sample**

```js
// The method runs a client report specified by the second parameter acording to the output format. 
// The report can be a compiled jasper file or a jrxml file from a relative path to the reportDirectory or an absolute one. 
// To view the result of the customers report in the Jasper Report viewer in the SmartClient or as PDF in the WebClient. 
// Note: the parameters argument is used to send additional parameters into the report. For example: 
// {pcustomerid: forms.customers.customer_id} to send just 1 parameter called pcustomerid, which contains the value 
// of dataprovider customer_id in the selected record on the customers form 
// The parameters argument is an Object, which can be instantiated in two ways: 
// var o = new Object(); 
// o.pcustomerid = forms.customers.customer_id; 
// or: 
// var o = {pcustomerid: forms.customers.customer_id}; 
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
ds = foundset.getDataSource(); 
var d = ds.split('/); 
var myServer = d[1];
plugins.jasperReports.runReport(myServer, 'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id});

// To request a report in a different Language than the current language of the client, it's possible to specify a Locale string
// as the locale argument. For example: 'en_US' or 'es_ES' or 'nl_NL' 
// When the locale argument is not specified, the report will be in the current langauge of the Client 
// i18n keys of Servoy can be used inside Jasper Reports using the $R{i18n-key} notation 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id},'nl_NL');

// To print the result of the customers report in the SmartClient (to a specified printer), 
// the outputType should be specified as 'print' (OUTPUT_FORMAT.PRINT). 
// The third parameter can contain the name of the printer to  which the report needs to be printed 
// or can contain true (boolean value) to show a print dialog before printing. 
// If false (boolean value) or null is specified, it will print without showing the print dialog to the default printer. 
// Note: In the WebClient a PDF will be pushed to the Client when the outputType is specified as 'print' (OUTPUT_FORMAT.PRINT). 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.PRINT,{pcustomerid: forms.customers.customer_id});

// To generate the report in the specified output format and save the result to 'myReport.html' in the root of the C drive: 
// Supported output formats are: xhtml, html, pdf, excel( or xls), xls_1_sheet (1 page per sheet), xlsx, ods, rtf, txt, csv, odt, docx, jrprint and xml. 
// These are available as constants in the OUTPUT_FORMAT node of the plugin's tree. 
// Note: in the WebClient, the file will be saved serverside, so the specified path needs to be valid serverside 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xhtml',OUTPUT_FORMAT.XHTML,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.html',OUTPUT_FORMAT.HTML,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.pdf',OUTPUT_FORMAT.PDF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.rtf',OUTPUT_FORMAT.RTF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.jrprint',OUTPUT_FORMAT.JRPRINT,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.txt',OUTPUT_FORMAT.TXT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.csv',OUTPUT_FORMAT.CSV,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.odt',OUTPUT_FORMAT.ODT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.docx',OUTPUT_FORMAT.DOCX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xlsx',OUTPUT_FORMAT.XLSX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS_1_SHEET,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.ods',OUTPUT_FORMAT.ODS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id});

// Jasper Reports supports queries with IN operators through the following notation: 
// X${IN,columnName,parameterName} like 'select * from customers where X$(IN,customer_id,pcustomeridlist) 
// When using this notation, the pcustomeridlist parameter needs to contain one or more values in the following way:
//var idlist = new Array(); 
//idlist[0] = 1; 
//idlist[1] = 26 ;
//plugins.jasperReports.jasperReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomeridlist: idlist}); 

//The return value is a byte array with the content of the file generated that can be further used. 
//var res = plugins.jasperReports.runReport(myServer,'samplereport.jrxml', null, OUTPUT_FORMAT.PDF, null);
//plugins.file.writeFile('e:\\\\sample.pdf', res);

// In order to run the report and move the table of contents(marked with the string: \"HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS\") 
// to the Insert page, which has to be identified by the string: \"HIDDEN TEXT TO MARK THE INSERT PAGE\" 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id}, null,true);

// Pass exporter parameters to the export process in runReport 
//var params = new Object();
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.title"] =  "Test title"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.author" ] = "Test Author";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.creator"] =  "Test creator"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.keywords" ] = "Test keywords";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.subject"] =  "Test subject";
//var r = plugins.jasperReports.runReport("myServer","someReport.jrxml","path/to/someReportExported.pdf",OUTPUT_FORMAT.PDF,params);

// Using an XML/CSV file as the datasource of the report.
//var $parameters = null; //...
//var $repfile = 'report.jrxml';
//var $xmlDataCombined = plugins.file.readTXTFile('/path/to/datasource.xml');
//var $locale = 'en';
//plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate/on', $repfile, null, OUTPUT_FORMAT.VIEW, $parameters, null)
```

### runReport(inputType, reportDataSource, inputOptions, report, outputOptions, outputType, parameters, localeString)

This method runs a specified (client) report according to the output format, parameters and locale. If using a table of contents and if needed, the table of contents can be moved to a specified page. Please refer to the sample code for more details.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **inputType** the type of the datasource, as one of the constants in INPUT\_TYPE
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **reportDataSource** reportDataSource the server name or foundset to run the report on
* [String](/reference/servoycore/dev-api/js-lib/string.md) **inputOptions** additional input options (e.g. which node to iterate in the xml datasource document)
* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the report file (relative to the reports directory)
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output file (must specify an absolute path) or null if not needed
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output format; use the constants node for available output formats
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **parameters** a parameter map to be used when running the report
* [String](/reference/servoycore/dev-api/js-lib/string.md) **localeString** a string which indicates the locale

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the generated reported as a byte array

**Sample**

```js
// The method runs a client report specified by the second parameter acording to the output format. 
// The report can be a compiled jasper file or a jrxml file from a relative path to the reportDirectory or an absolute one. 
// To view the result of the customers report in the Jasper Report viewer in the SmartClient or as PDF in the WebClient. 
// Note: the parameters argument is used to send additional parameters into the report. For example: 
// {pcustomerid: forms.customers.customer_id} to send just 1 parameter called pcustomerid, which contains the value 
// of dataprovider customer_id in the selected record on the customers form 
// The parameters argument is an Object, which can be instantiated in two ways: 
// var o = new Object(); 
// o.pcustomerid = forms.customers.customer_id; 
// or: 
// var o = {pcustomerid: forms.customers.customer_id}; 
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
ds = foundset.getDataSource(); 
var d = ds.split('/); 
var myServer = d[1];
plugins.jasperReports.runReport(myServer, 'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id});

// To request a report in a different Language than the current language of the client, it's possible to specify a Locale string
// as the locale argument. For example: 'en_US' or 'es_ES' or 'nl_NL' 
// When the locale argument is not specified, the report will be in the current langauge of the Client 
// i18n keys of Servoy can be used inside Jasper Reports using the $R{i18n-key} notation 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id},'nl_NL');

// To print the result of the customers report in the SmartClient (to a specified printer), 
// the outputType should be specified as 'print' (OUTPUT_FORMAT.PRINT). 
// The third parameter can contain the name of the printer to  which the report needs to be printed 
// or can contain true (boolean value) to show a print dialog before printing. 
// If false (boolean value) or null is specified, it will print without showing the print dialog to the default printer. 
// Note: In the WebClient a PDF will be pushed to the Client when the outputType is specified as 'print' (OUTPUT_FORMAT.PRINT). 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.PRINT,{pcustomerid: forms.customers.customer_id});

// To generate the report in the specified output format and save the result to 'myReport.html' in the root of the C drive: 
// Supported output formats are: xhtml, html, pdf, excel( or xls), xls_1_sheet (1 page per sheet), xlsx, ods, rtf, txt, csv, odt, docx, jrprint and xml. 
// These are available as constants in the OUTPUT_FORMAT node of the plugin's tree. 
// Note: in the WebClient, the file will be saved serverside, so the specified path needs to be valid serverside 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xhtml',OUTPUT_FORMAT.XHTML,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.html',OUTPUT_FORMAT.HTML,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.pdf',OUTPUT_FORMAT.PDF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.rtf',OUTPUT_FORMAT.RTF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.jrprint',OUTPUT_FORMAT.JRPRINT,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.txt',OUTPUT_FORMAT.TXT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.csv',OUTPUT_FORMAT.CSV,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.odt',OUTPUT_FORMAT.ODT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.docx',OUTPUT_FORMAT.DOCX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xlsx',OUTPUT_FORMAT.XLSX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS_1_SHEET,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.ods',OUTPUT_FORMAT.ODS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id});

// Jasper Reports supports queries with IN operators through the following notation: 
// X${IN,columnName,parameterName} like 'select * from customers where X$(IN,customer_id,pcustomeridlist) 
// When using this notation, the pcustomeridlist parameter needs to contain one or more values in the following way:
//var idlist = new Array(); 
//idlist[0] = 1; 
//idlist[1] = 26 ;
//plugins.jasperReports.jasperReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomeridlist: idlist}); 

//The return value is a byte array with the content of the file generated that can be further used. 
//var res = plugins.jasperReports.runReport(myServer,'samplereport.jrxml', null, OUTPUT_FORMAT.PDF, null);
//plugins.file.writeFile('e:\\\\sample.pdf', res);

// In order to run the report and move the table of contents(marked with the string: \"HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS\") 
// to the Insert page, which has to be identified by the string: \"HIDDEN TEXT TO MARK THE INSERT PAGE\" 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id}, null,true);

// Pass exporter parameters to the export process in runReport 
//var params = new Object();
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.title"] =  "Test title"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.author" ] = "Test Author";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.creator"] =  "Test creator"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.keywords" ] = "Test keywords";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.subject"] =  "Test subject";
//var r = plugins.jasperReports.runReport("myServer","someReport.jrxml","path/to/someReportExported.pdf",OUTPUT_FORMAT.PDF,params);

// Using an XML/CSV file as the datasource of the report.
//var $parameters = null; //...
//var $repfile = 'report.jrxml';
//var $xmlDataCombined = plugins.file.readTXTFile('/path/to/datasource.xml');
//var $locale = 'en';
//plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate/on', $repfile, null, OUTPUT_FORMAT.VIEW, $parameters, null)
```

### runReport(inputType, reportDataSource, inputOptions, report, outputOptions, outputType, parameters, localeString, moveTableOfContent)

This method runs a specified (client) report according to the output format, parameters and locale. If using a table of contents and if needed, the table of contents can be moved to a specified page. Please refer to the sample code for more details.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **inputType** the type of the datasource, as one of the constants in INPUT\_TYPE
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **reportDataSource** the server name or foundset to run the report on
* [String](/reference/servoycore/dev-api/js-lib/string.md) **inputOptions** additional input options (e.g. which node to iterate in the xml datasource document)
* [String](/reference/servoycore/dev-api/js-lib/string.md) **report** the report file (relative to the reports directory)
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **outputOptions** the output file (must specify an absolute path) or null if not needed
* [String](/reference/servoycore/dev-api/js-lib/string.md) **outputType** the output format; use the constants node for available output formats
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **parameters** a parameter map to be used when running the report
* [String](/reference/servoycore/dev-api/js-lib/string.md) **localeString** a string which indicates the locale
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **moveTableOfContent** true in order to move the table of contents, false otherwise

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) the generated reported as a byte array

**Sample**

```js
// The method runs a client report specified by the second parameter acording to the output format. 
// The report can be a compiled jasper file or a jrxml file from a relative path to the reportDirectory or an absolute one. 
// To view the result of the customers report in the Jasper Report viewer in the SmartClient or as PDF in the WebClient. 
// Note: the parameters argument is used to send additional parameters into the report. For example: 
// {pcustomerid: forms.customers.customer_id} to send just 1 parameter called pcustomerid, which contains the value 
// of dataprovider customer_id in the selected record on the customers form 
// The parameters argument is an Object, which can be instantiated in two ways: 
// var o = new Object(); 
// o.pcustomerid = forms.customers.customer_id; 
// or: 
// var o = {pcustomerid: forms.customers.customer_id}; 
application.updateUI(); //to make sure the Servoy window doesn't grab focus after showing the Jasper Viewer var
ds = foundset.getDataSource(); 
var d = ds.split('/); 
var myServer = d[1];
plugins.jasperReports.runReport(myServer, 'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id});

// To request a report in a different Language than the current language of the client, it's possible to specify a Locale string
// as the locale argument. For example: 'en_US' or 'es_ES' or 'nl_NL' 
// When the locale argument is not specified, the report will be in the current langauge of the Client 
// i18n keys of Servoy can be used inside Jasper Reports using the $R{i18n-key} notation 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomerid: forms.customers.customer_id},'nl_NL');

// To print the result of the customers report in the SmartClient (to a specified printer), 
// the outputType should be specified as 'print' (OUTPUT_FORMAT.PRINT). 
// The third parameter can contain the name of the printer to  which the report needs to be printed 
// or can contain true (boolean value) to show a print dialog before printing. 
// If false (boolean value) or null is specified, it will print without showing the print dialog to the default printer. 
// Note: In the WebClient a PDF will be pushed to the Client when the outputType is specified as 'print' (OUTPUT_FORMAT.PRINT). 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.PRINT,{pcustomerid: forms.customers.customer_id});

// To generate the report in the specified output format and save the result to 'myReport.html' in the root of the C drive: 
// Supported output formats are: xhtml, html, pdf, excel( or xls), xls_1_sheet (1 page per sheet), xlsx, ods, rtf, txt, csv, odt, docx, jrprint and xml. 
// These are available as constants in the OUTPUT_FORMAT node of the plugin's tree. 
// Note: in the WebClient, the file will be saved serverside, so the specified path needs to be valid serverside 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xhtml',OUTPUT_FORMAT.XHTML,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.html',OUTPUT_FORMAT.HTML,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.pdf',OUTPUT_FORMAT.PDF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.rtf',OUTPUT_FORMAT.RTF,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.jrprint',OUTPUT_FORMAT.JRPRINT,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.txt',OUTPUT_FORMAT.TXT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.csv',OUTPUT_FORMAT.CSV,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.odt',OUTPUT_FORMAT.ODT,{pcustomeri d : forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.docx',OUTPUT_FORMAT.DOCX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xlsx',OUTPUT_FORMAT.XLSX,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xls',OUTPUT_FORMAT.XLS_1_SHEET,{pcustomerid: forms.customers.customer_id}); 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.ods',OUTPUT_FORMAT.ODS,{pcustomerid: forms.customers.customer_id});
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id});

// Jasper Reports supports queries with IN operators through the following notation: 
// X${IN,columnName,parameterName} like 'select * from customers where X$(IN,customer_id,pcustomeridlist) 
// When using this notation, the pcustomeridlist parameter needs to contain one or more values in the following way:
//var idlist = new Array(); 
//idlist[0] = 1; 
//idlist[1] = 26 ;
//plugins.jasperReports.jasperReport(myServer,'myCustomerReport.jasper',null,OUTPUT_FORMAT.VIEW,{pcustomeridlist: idlist}); 

//The return value is a byte array with the content of the file generated that can be further used. 
//var res = plugins.jasperReports.runReport(myServer,'samplereport.jrxml', null, OUTPUT_FORMAT.PDF, null);
//plugins.file.writeFile('e:\\\\sample.pdf', res);

// In order to run the report and move the table of contents(marked with the string: \"HIDDEN TEXT TO MARK THE BEGINNING OF THE TABEL OF CONTENTS\") 
// to the Insert page, which has to be identified by the string: \"HIDDEN TEXT TO MARK THE INSERT PAGE\" 
//plugins.jasperReports.runReport(myServer,'myCustomerReport.jasper','c:/myReport.xml',OUTPUT_FORMAT.XML,{pcustomerid: forms.customers.customer_id}, null,true);

// Pass exporter parameters to the export process in runReport 
//var params = new Object();
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.title"] =  "Test title"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.author" ] = "Test Author";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.creator"] =  "Test creator"; 
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.keywords" ] = "Test keywords";
//params["EXPORTER_PARAMETER:net.sf.jasperreports.export.pdf.metadata.subject"] =  "Test subject";
//var r = plugins.jasperReports.runReport("myServer","someReport.jrxml","path/to/someReportExported.pdf",OUTPUT_FORMAT.PDF,params);

// Using an XML/CSV file as the datasource of the report.
//var $parameters = null; //...
//var $repfile = 'report.jrxml';
//var $xmlDataCombined = plugins.file.readTXTFile('/path/to/datasource.xml');
//var $locale = 'en';
//plugins.jasperReports.runReport(plugins.jasperReports.INPUT_TYPE.XML, $xmlDataCombined, '/node/to/iterate/on', $repfile, null, OUTPUT_FORMAT.VIEW, $parameters, null)
```

### writeFileToReportsDir(fileName, obj)

Store a reportFile on the Server.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **fileName** the name of the file to write to
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **obj** the object file to write

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the write was successful, false otherwise

**Sample**

```js
// .jasper or .jrxml files can be used var 
file = plugins.file.readFile('\\\\temp\\\\sample.jasper');
plugins.jasperReports.writeFileToReportsDir('myCustomerReport.jasper', file); 
// Writes to a subfolder from the reports directory. All the folders from the path must exist. 
plugins.jasperReports.writeFileToReportsDir('\\\\subdir\\\\myCustomerReport.jasper', file);
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/guides/develop/programming-guide/jasperreports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
