In the previous parts (Part 1 Part 2 Part 3 Part 4) we covered plain export, styling your exports and doing selective exports. Today I want to show you how to create more advanced and flexible way to get your data using a java object that we use for the export.
We start by creating 2 java classes one for the export and one of the Export Data
Then in each class add implements Serializable and the private variable on the row below. This is so the java VM can swap the data out disk if needed.
We will start by creating our data class, very simple. Check what type of data you want to export in each column, in my case I want to export
And then we use the generate setters/getters function in DDE by right clicking in the source window
And select all variables you want to autogenerate setter and getters for an click on OK
Time to create the getData function in the Export class the important thing here is that we return a a java object of the type List.
I also create the function as static because I will only run this function and return the data once. This is the code for the export class. The important thing to point out is
The I create the Exportdata object on each row and store it in the RowData variable
And when I have populated it I add it to the Data ArrayList Object the is returned from the function at the end.
In my Excel export component in All properties datarowexport and I select to create a wgpoi:ListObjectDataSource.
And click on the buildValues property to add some source
And we add this simple code to get the data from the Java objects returned you can expand you getData class and sending in filter parameters from the XPage as we did in Part 4 of this series but in this case the filtering will be done in java.
But wait, you might say how do we populate the column data. That’s the great part of the implementation. You write the name of you variable in you data class and the getter will do the rest. so in this case it will call getName from your row class that is returned.
With this new way of exporting you can combine the data from different sources not only one as I’ve shown in the past parts of this series of posts and giving even better exports to you users.
Integrating a better export into your application will make your users happier
Very cool Fredrik! Thats impressive. Did not even think of that.
thanks for the article 🙂
Thanks Frank, really helpful.
Is thera a pic/attachment missing in your explanation above?
This is the section where i am looking for (??????):
I also create the function as static because I will only run this function and return the data once. This is the code for the export class. The important thing to point out is
???????
The I create the Exportdata object on each row and store it in the RowData variable
Thanks Frederik, really helpful.
Is thera a pic/attachment missing in your explanation above?
This is the section where i am looking for (??????):
I also create the function as static because I will only run this function and return the data once. This is the code for the export class. The important thing to point out is
???????
The I create the Exportdata object on each row and store it in the RowData variable
Thanks Frederik, really helpful.
Is thera a pic/attachment missing in your explanation above?
This is the section where i am looking for (??????):
I also create the function as static because I will only run this function and return the data once. This is the code for the export class. The important thing to point out is
???????
The I create the Exportdata object on each row and store it in the RowData variable
Hi there,
Do you think that will be possible to schedule export all e-mails in inbox to excel?
What I mean – want every day to have my inbox on excel (export to csv, or different readable in excel way). If I have possibilities to automate export will stop to wonder if I missed to export, or lose time to export again. 🙂
Most important for me information can be structured in followed columns:
1. Sender (column Who)
2. Subject. If no subject, get all message from e-mail.
3. Receiving date (column Date)
4. Flag if e-mail was opened (read)
After that I can automatize import in excel and will have copy of important information from inbox.
Best regards
Todor Todorov
P.S. Just as detail (think not so important), but most e-mails was written on Cyrillic.
It shouldn’t be that much trouble doing this with lotusscript with a scheduled agent in the mailfile but the csv file will be stored on the server or a networkshare the server has access to.