App maker: Show Big Query data in grid

限于喜欢 提交于 2020-01-06 06:46:10

问题


I having an script in googles app maker:

    function runQuery() {
  var projectId = 'blalab155512';
  var request = {
    query: 'SELECT title FROM [bigquery-public-data:samples.wikipedia]  where title contains "olimpic" LIMIT 100'
  };
  var queryResults = BigQuery.Jobs.query(request, projectId);
  var jobId = queryResults.jobReference.jobId;
  var names = queryResults.schema.fields.map(function(field){ return field.name; });


  //var records = [];  
  return queryResults.rows.map(function(row) {
  var record = app.models.Test.newRecord();
  for (var i = 0, len = names.length; i < len; ++i) {
    // Calculated model should contain correspondent fields
    // all non-defined fields will be ignored
    record[names[i]] =  (row.f[i].v);
  }

  return record;
});
}

Which gives me the desired data from Big Query. Data format output from Logger:

I'm now struggling with put that data as an Calculated Data Source and then show it as a grid within the app.

I have a calculated data source, which calls the script above to get the data. And I configured a field (String) in which I want to out the titles from the query.

In preview no error was shown but the grid stay empty:


回答1:


Unlike Table widget, Grid widget will not generate all nested data-bound widgets for you. You need to manually add, layout and bind all display widgets:



来源:https://stackoverflow.com/questions/50701731/app-maker-show-big-query-data-in-grid

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