on 2017 Aug 17 9:59 AM
Hi there,
I have build an application with multiple tabs, each tab has it own report number dropdown menue (1 to 10) and each tab has it own filters and start button for the query.
When clicking start, a pop-up dialog with the results of the queries appears, depending on the report number selection there are multiple tabs (1-10). Now there is a Export to Excel button which needs to be scripted.
Exporting to Excel in Standard:
APPLICATION.export(ExportType.EXCEL_xlsx,Crosstab1);
Exporting multiple crosstabs to Excel:
APPLICATION.export(ExportType.EXCEL_xlsx, [Crosstab1, Crosstab2, ... ] );
But how do I code a export for all 10 possible Crosstabs? I dont want to export crosstabs when there is no data inside, so I tried:
var x= Crosstab_1,Crosstab_2,Crosstab_3,Crosstab_4,Crosstab_5,Crosstab_6,Crosstab_7,Crosstab_8,Crosstab_9,Crosstab_10];
x.forEach(function(element, index) {
if (element.getDataSource().isResultSetEmpty()==true){
x.pop();
} });
APPLICATION.export(ExportType.EXCEL_xlsx,x,ExportSettings.CSV_SEPARATOR_COMMA);
Error Log says:
"Cannot call method "isResultSetEmpty" of null (BIAL Script #88)"
Any ideas ? Thanks in advance!
Request clarification before answering.
var myArray=[CROSSTAB1];
if (CROSSTAB1.getDataSource().isResultSetEmpty()==true) {
myArray.pop();
}
if (CROSSTAB2.getDataSource().isResultSetEmpty()==false) {
myArray.push(CROSSTAB2);
}
. . .
APPLICATION.export(ExportType.EXCEL_xlsx,myArray);
Done 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
29 | |
9 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.