01. Configure CSV Export


How to export a CSV with POI4XPAGES
1. Download POI4Xpages
2. Install the Extension on your Server and Designer Client

1. Open the XPage on which the export should be performed.

Add the ‘CSV Output’ control to the XPage


Select the CSV Output control and switch to the properties panel to configure the export.



The downloadFileName specifies the name of the file which will be created.
By setting the includeHeader to true the Title of the columns which we are going to define later will be exported as well.

The pathInfo can be used if you like to call the export function directly by a URL. By enter the URL xpagename.xsp/pathInfo/file.csv the export starts automatically.


For the export you can choose either a dominoViewSource, a ListObjectDataSource or a dataSource from
In this case we used a dominoViewSource:

· database: define the database which has to be used, empty means the current database
· key: The key is compared to the first sorted column in the view (like the getAllDocumentsByKey method)
· maxRow: the maximum (currently 1’500 entries) of entries to export
· search: a fulltext search query
· viewName: specifies the name of the view with the records to export


Assign the columns:
her

Each column needs a csvcolumn definition
· columnTitle: the title of the column from the view defined as dataSource
· computedValue: with release 1.1.5 you have now the opportunity to execute a function to get the value to export.
· position: the position of the value in the export.
· title: this value is used in the header row, if includeHeader is set to true.
·




The configuration is now done. Let us export the csv file by button. The button needs an “onClick()” eventhandler like this:

Choose “Generate CSV” and select the ID of the CSV definition.