Export filtered data from table widget Google AppMaker to a Spreadsheet

浪子不回头ぞ 提交于 2019-12-13 07:55:47

问题


Does anyone know how we can export filtered data from Google App Maker table widget.

My table from the data source (no filter):

After applying some filter

.

I manage to export everything to Google Spreadsheet (see this SO answer), but I am stuck on exporting only the data after applying some filter. Really appreciate if anyone can share the solution. Thanks!


回答1:


The AMU Library can do this in one command in a button onClick. The button just needs to be on the same datasource as the table.

Simply:

AMU.export.toSpreadsheet = function(widget, Your_modelName);



回答2:


It seems that you are looking for filters. It should work if you modify script from this answer to something similar to this:

// Server script
function dataExport(filter1, filter2, ...) {
  // TODO: Check permissions.
  ...
  var query = app.models.MyModel.newQuery();

  // TODO: Apply user/roles specific filters for
  // security reasons.
  query.filters.Field1._equals = filter1;
  query.filters.Field2._greaterThan = filter2;
  ...
  var filteredRecords = query.run();

  filteredRecords.forEach(function(record) {
    ...
  });
  ...


来源:https://stackoverflow.com/questions/49471316/export-filtered-data-from-table-widget-google-appmaker-to-a-spreadsheet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!