![](/img/trans.png)
[英]Google Data Studio - Custom Connector - Get Data parsing json
[英]Data Studio Custom Connector wrong amount of fields
Data Studio 自定义连接器的新功能。 我已经能够正确地学习教程,但是在做任何更高级的事情时遇到了麻烦。 以下是我的 getData() function 返回的内容:
{
"schema": [
{
"semantics": {
"semanticType": "TEXT",
"conceptType": "DIMENSION"
},
"name": "Series",
"dataType": "STRING",
"label": "Series"
},
{
"name": "$overall",
"dataType": "NUMBER",
"semantics": {
"conceptType": "METRIC",
"semanticType": "NUMBER",
"isReaggregatable": true
},
"defaultAggregationType": "SUM"
},
{
"name": "undefined",
"defaultAggregationType": "SUM",
"semantics": {
"isReaggregatable": true,
"semanticType": "NUMBER",
"conceptType": "METRIC"
},
"dataType": "NUMBER"
},
{
"dataType": "NUMBER",
"defaultAggregationType": "SUM",
"semantics": {
"isReaggregatable": true,
"conceptType": "METRIC",
"semanticType": "NUMBER"
},
"name": "Student"
},
{
"semantics": {
"semanticType": "NUMBER",
"isReaggregatable": true,
"conceptType": "METRIC"
},
"name": "Teacher",
"defaultAggregationType": "SUM",
"dataType": "NUMBER"
},
{
"defaultAggregationType": "SUM",
"semantics": {
"conceptType": "METRIC",
"isReaggregatable": true,
"semanticType": "NUMBER"
},
"name": "Principal",
"dataType": "NUMBER"
},
{
"dataType": "NUMBER",
"defaultAggregationType": "SUM",
"semantics": {
"semanticType": "NUMBER",
"conceptType": "METRIC",
"isReaggregatable": true
},
"name": "Assistant"
},
{
"dataType": "NUMBER",
"semantics": {
"conceptType": "METRIC",
"semanticType": "NUMBER",
"isReaggregatable": true
},
"name": "Staff",
"defaultAggregationType": "SUM"
}
],
"rows": [
{
"values": [
"All Events - Unique",
1338,
1137,
987,
112,
10,
9,
1
]
}
]
}
您会注意到架构中的字段数 - 8 - 与数据行中的字段数相匹配。
此外,所有 8 个字段在 Data Studio 中都显示良好。 但是当我尝试通过将图表或记分卡放入 DS 中来实际使用统计信息时,我得到以下信息:
系统错误 Data Studio 遇到系统错误。
从社区连接器返回的数据中收到的列数与 Data Studio 请求的列数不匹配。 如果此问题仍然存在,请将此问题报告给此社区连接器的提供商。
有什么明显的我在这里错了吗?
提前致谢。
我在这里的误解是普遍的。 当我 select 来自 Data Studio 的单个或多个字段时,只需为适用的字段调用 getData(),这些字段通过 request.fields 参数发送。 然后它需要返回过滤掉的架构和过滤掉的行数据。
看到教程里面字段有一些过滤,只是没有把两个和两个放在一起。 我本以为 DS 会足够聪明,可以接收所有数据,然后过滤出它需要的数据,但它不是这样工作的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.