Using a button to export multiple records
I typically use the gear to export a selection of records to a CSV/Excel sheet. What I would like to do is do this using a button. How does one code for this?
11 replies
-
Why no answer here?
-
From the looks of it there is no way to export through a button. Maybe through javascript or through a json you can "export".
One possiblility is the use of createTempFile, but I don't use the cloud version so I can't test it out.
-
Do you just want to open the export interface with a button?
If so, you put this code on your button (need to use NativeJS)
#{ ui.currentView.table.menuExportData() }#
If you want to execute the export directly, you can do it with this code (only for the could version):
var fileName := "myExport2.csv"; var exportSettings := { sep: ",", qut: """", lf: "%0D%0A", numberFormat: "point", dateFormat: "locale", header: true, sepHeader: false, encoding: "utf8" } #{:text:callback window.util.renderCSV(window.database, window.ui.currentView.table, exportSettings) .then((textData) => { NinoxDocumentInteraction.openFileWithServer(fileName, 'text/csv', textData, !1, !0) callback(textData) }) }#;
exportSettings corresponds to the information requested from the user in the export interface.
For App version, you can create text file with your data :
var fileName := "myExport2.csv"; var exportSettings := { sep: ",", qut: """", lf: "%0D%0A", numberFormat: "point", dateFormat: "locale", header: true, sepHeader: false, encoding: "utf8" } var data := #{:text:callback window.util.renderCSV(window.database, window.ui.currentView.table, exportSettings) .then((textData) => { callback(textData); }) }#; createTextFile( this, data, fileName );
The file is attached to current record.
Content aside
-
2
Likes
- 2 yrs agoLast active
- 11Replies
- 536Views
-
3
Following