添加特定维度后,Data Studio是否有理由无法连接到我的数据源?

时间:2019-03-27 17:04:02

标签: google-data-studio

我当前正在尝试连接到包含表单数据的数据源。一些字段是可选的,例如_vfb_field-1048,它是国家。当我将除可选字段(例如_vfb_field-1048)之外的所有内容都放进去时,它工作得很好。当我添加这些尺寸时,它会告诉我:

Data Studio无法连接到您的数据集。 无法从基础数据集中获取数据 错误ID:929212f4

您知道我需要做什么才能显示数据吗?

数据示例(不是完整的数据,所以不要介意格式):

元:{ _vfb_field-1045:“约翰”, _vfb_field-1069:“ 15551234567”, _vfb_field-1046:“ Doe”, _vfb_field-1047:“ email@example.com”, _vfb_field-1048:“美国”, _vfb_field-1049:“在线”, _vfb_form_id:“ 72”, _vfb_entry_id:“ 13560” }

元:{ _vfb_field-1045:“约翰”, _vfb_field-1069:“ 15551234567”, _vfb_field-1046:“ Doe”, _vfb_field-1047:“ email@example.com”, _vfb_field-1048:“”, _vfb_field-1049:“在线”, _vfb_form_id:“ 72”, _vfb_entry_id:“ 13561” } Empty Data With Data in it

function getFields() {
  var cc = DataStudioApp.createCommunityConnector();
  var fields = cc.getFields();
  var types = cc.FieldType;
  var aggregations = cc.AggregationType;

  fields.newDimension()
      .setId('slug')
      .setName('Slug')
      .setType(types.TEXT);

  fields.newDimension()
      .setId('country')
      .setName('Country')
      .setType(types.TEXT);

  fields.newDimension()
      .setId('form')
      .setName('Form')
      .setType(types.TEXT);


  fields.newMetric()
      .setId('id')
      .setName('ID')
      .setType(types.NUMBER)
      .setAggregation(aggregations.SUM);

  return fields;
}
function getSchema(request) {
  var fields = getFields().build();
  return {'schema': fields};
}

function responseToRows(requestedFields, response) {
  // Transform parsed data and filter for requested fields
  return response.map(function(dailyDownload) {
    var row = [];
    requestedFields.asArray().forEach(function(field) {
      switch (field.getId()) {
        case 'slug':
          return row.push(dailyDownload.slug);
        case 'country':
          return row.push(dailyDownload.meta._vfb_field-1048);
        case 'id':
          return row.push(dailyDownload.id);
        case 'form':
          return row.push(dailyDownload.meta._vfb_form_id);  
        default:
          return row.push('');
      }
    });
    return {values: row};
  });
} 

0 个答案:

没有答案