关于 GoodData 中的 AttributeFilter 的问题 UI
Issue about AttributeFilter in GoodData UI
我在 GoodData UI 中使用了 AttributeFilter 但显示:
抱歉,我们无法找到此见解
URL 的见解不存在。
我用了这个例子:https://sdk.gooddata.com/gooddata-ui/docs/filter_visual_components.html#attributefilter
如何修复?
onApply = (filter) => {
console.log('AttributeFilterExample filter', filter);
const isPositive = !!filter.in;
const elementsProp = isPositive ? 'in' : 'notIn';
const filters = [{
[isPositive ? 'positiveAttributeFilter' : 'negativeAttributeFilter']: {
displayForm: {
uri: filter.id
},
[elementsProp]: filter[elementsProp].map(element => (`/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1082/elements?id=${element}`))
}
}];
this.setState({ filters });
}
render() {
const { filters } = this.state;
return (
<div className="App">
<div style={{ height: 400, width: 600 }}>
<AttributeFilter
identifier={"label.cliente.cliente.nome"}
projectId={"dkrwpz8ki4iplckqups7luwz8uiviacy"}
fullscreenOnMobile={false}
onApply={this.onApply}
/>
<div style={{ height: 400, width: 600 }}>
<Visualization
identifier="aauAZOTPefMe"
projectId="dkrwpz8ki4iplckqups7luwz8uiviacy"
filters={filters}
/>
</div>
</div>
</div>
); }
请求负载
{"execution":{"afm":{"attributes":[{"displayForm":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1048"},"localIdentifier" :"2ece68a1703740468b227334a79639b8"},{"displayForm":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1082"},"localIdentifier":"5e544ec629ee499f86bd4cd573cfe3b5"}],"measures":[{"localIdentifier":"c0f04ea170dc44879d645e55db7b3025","definition":{"measure":{"item":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/5215"},"aggregation":"sum"}},"alias":"Soma de Vl Faturamento Total","format":"#,##0.00"},{"localIdentifier":"d966647e4441403bb2a970db13e97440" ,"definition":{"measure":{"item":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/22925"}}},"alias":"Peso Bruto [Faturamento]" }],"filters":[{"positiveAttributeFilter":{"displayForm":{"identifier":"label.cliente.cliente.nome"},"in":["/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1082/elements?id=347900"]}}],"nativeTotals":[]},"resultSpec":{"sorts":[{"attributeSortItem":{"attributeIdentifier" :“5e544ec629ee499f86bd4cd573cfe3b5”,"direction":"asc"}}],"dimensions":[{"itemIdentifiers":[“2ece68a1703740468b227334a79639b8”,“5e544ec629ee499f86bd4cd5[76]cfe3,{65=]:[” ]:["measureGroup"]}]}}}
我更改了元素 id 中的对象,工作成功。
谢谢伊万。
我在 GoodData UI 中使用了 AttributeFilter 但显示:
抱歉,我们无法找到此见解 URL 的见解不存在。
我用了这个例子:https://sdk.gooddata.com/gooddata-ui/docs/filter_visual_components.html#attributefilter
如何修复?
onApply = (filter) => {
console.log('AttributeFilterExample filter', filter);
const isPositive = !!filter.in;
const elementsProp = isPositive ? 'in' : 'notIn';
const filters = [{
[isPositive ? 'positiveAttributeFilter' : 'negativeAttributeFilter']: {
displayForm: {
uri: filter.id
},
[elementsProp]: filter[elementsProp].map(element => (`/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1082/elements?id=${element}`))
}
}];
this.setState({ filters });
}
render() {
const { filters } = this.state;
return (
<div className="App">
<div style={{ height: 400, width: 600 }}>
<AttributeFilter
identifier={"label.cliente.cliente.nome"}
projectId={"dkrwpz8ki4iplckqups7luwz8uiviacy"}
fullscreenOnMobile={false}
onApply={this.onApply}
/>
<div style={{ height: 400, width: 600 }}>
<Visualization
identifier="aauAZOTPefMe"
projectId="dkrwpz8ki4iplckqups7luwz8uiviacy"
filters={filters}
/>
</div>
</div>
</div>
); }
请求负载 {"execution":{"afm":{"attributes":[{"displayForm":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1048"},"localIdentifier" :"2ece68a1703740468b227334a79639b8"},{"displayForm":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1082"},"localIdentifier":"5e544ec629ee499f86bd4cd573cfe3b5"}],"measures":[{"localIdentifier":"c0f04ea170dc44879d645e55db7b3025","definition":{"measure":{"item":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/5215"},"aggregation":"sum"}},"alias":"Soma de Vl Faturamento Total","format":"#,##0.00"},{"localIdentifier":"d966647e4441403bb2a970db13e97440" ,"definition":{"measure":{"item":{"uri":"/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/22925"}}},"alias":"Peso Bruto [Faturamento]" }],"filters":[{"positiveAttributeFilter":{"displayForm":{"identifier":"label.cliente.cliente.nome"},"in":["/gdc/md/dkrwpz8ki4iplckqups7luwz8uiviacy/obj/1082/elements?id=347900"]}}],"nativeTotals":[]},"resultSpec":{"sorts":[{"attributeSortItem":{"attributeIdentifier" :“5e544ec629ee499f86bd4cd573cfe3b5”,"direction":"asc"}}],"dimensions":[{"itemIdentifiers":[“2ece68a1703740468b227334a79639b8”,“5e544ec629ee499f86bd4cd5[76]cfe3,{65=]:[” ]:["measureGroup"]}]}}}
我更改了元素 id 中的对象,工作成功。
谢谢伊万。