When saving query results in ADS, saving in excel format saves the data with the first columns starting at column A and the first rows at row 1. Saving data in excel format using aqua.report with an aquascript however saves the data with the first column starting at column B and the first rows starting at row 4. The aquascript I'm using is that created by ADS from the Save As dialog's AquaScript tab.
I cannot find any setting to remove this padding even though I've turned off titles and report time, etc. in the dataSetSettings.
|
161 KB
Hi Tim,
If all you want is to save data in a spreadsheet. You can do it this way
Thanks,
Tom
//******************************************************************* // Input parameters. //******************************************************************* var server ="DB2 LUW 172.24.1.199 v11.5"; var database = ""; var schema = "TOM"; var sqlQuery = "select * from TOM.AQUA_CUSTOMER"; var filePathtoStore = "C:/Users/tomEditortest/report.xls"; try { var conn = aqua.project.getServerConnection(server); conn.connect(); conn.changeSchema(schema); var resultset = conn.executeQuery(sqlQuery); var sheet = aqua.data.excelSpreadsheet(filePathtoStore); sheet.clear(); sheet.insert(resultset.columnStructure); while (resultset.next()) { sheet.insert(resultset.getRow()) } sheet.save(); conn.disconnect(); } catch(err) { aqua.console.println(err.lineNumber + ": " + err); }
Thanks for that excellent example and the quick reply Tom. This would be better when dealing with a large dataset as well since it doesn't have to be buffered in memory.
This alternative aside, it does seem like a report's dataSetSettings should have a means of controlling the row and column that data is written to.
Thanks for that excellent example and the quick reply Tom. This would be better when dealing with a large dataset as well since it doesn't have to be buffered in memory.
This alternative aside, it does seem like a report's dataSetSettings should have a means of controlling the row and column that data is written to.
Hi Tim,
I agree that we should have more flexibility when generating a report. In looking at the code, I think that the report structure was set up that way to leave space for a header, title and footer. I will leave this issue open for us to look into enhancing the openapi, in a future release, to better handle the formatting.
Thanks,
Tom
Hi Tim,
I agree that we should have more flexibility when generating a report. In looking at the code, I think that the report structure was set up that way to leave space for a header, title and footer. I will leave this issue open for us to look into enhancing the openapi, in a future release, to better handle the formatting.
Thanks,
Tom
Issue #15884 |
New |
Completion |
No due date |
No fixed build |
No time estimate |
Hi Tim,
If all you want is to save data in a spreadsheet. You can do it this way
Thanks,
Tom