Skip to content

Commit b82f897

Browse files
Merge pull request #1487 from gooddata/snapshot-master-a20aae62-to-rel/dev
[bot] Merge master/a20aae62 into rel/dev
2 parents 2a2534e + a20aae6 commit b82f897

3 files changed

Lines changed: 158 additions & 0 deletions

File tree

packages/gooddata-sdk/src/gooddata_sdk/visualization.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ def _convert_filter_to_computable(filter_obj: dict[str, Any]) -> Filter:
185185
not_in_values = f["notIn"]["values"] if "values" in f["notIn"] else f["notIn"]["uris"]
186186

187187
return NegativeAttributeFilter(label=ref_extract(f["displayForm"]), values=not_in_values)
188+
elif "arbitraryAttributeFilter" in filter_obj:
189+
f = filter_obj["arbitraryAttributeFilter"]
190+
label = ref_extract(f["label"])
191+
values = f.get("values", [])
192+
if f.get("negativeSelection", False):
193+
return NegativeAttributeFilter(label=label, values=values)
194+
return PositiveAttributeFilter(label=label, values=values)
188195
elif "matchAttributeFilter" in filter_obj:
189196
f = filter_obj["matchAttributeFilter"]
190197
return MatchAttributeFilter(
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"buckets": [
3+
{
4+
"items": [
5+
{
6+
"measure": {
7+
"definition": {
8+
"measureDefinition": {
9+
"item": {
10+
"identifier": {
11+
"id": "aangOxLSeztu",
12+
"type": "metric"
13+
}
14+
}
15+
}
16+
},
17+
"localIdentifier": "m_aangOxLSeztu"
18+
}
19+
}
20+
],
21+
"localIdentifier": "measures"
22+
},
23+
{
24+
"items": [
25+
{
26+
"attribute": {
27+
"displayForm": {
28+
"identifier": {
29+
"id": "label.opportunity.id.name",
30+
"type": "label"
31+
}
32+
},
33+
"localIdentifier": "a_label.opportunity.id.name"
34+
}
35+
}
36+
],
37+
"localIdentifier": "view"
38+
},
39+
{
40+
"items": [],
41+
"localIdentifier": "stack"
42+
}
43+
],
44+
"filters": [
45+
{
46+
"arbitraryAttributeFilter": {
47+
"localIdentifier": "9f2db153ca1f4beaa79d09e6ff43ce69",
48+
"label": {
49+
"identifier": {
50+
"id": "attr.f_opportunitysnapshot.oppsnapshot",
51+
"type": "label"
52+
}
53+
},
54+
"values": [
55+
"245519",
56+
"237519",
57+
"241519"
58+
]
59+
}
60+
},
61+
{
62+
"arbitraryAttributeFilter": {
63+
"localIdentifier": "abc123",
64+
"label": {
65+
"identifier": {
66+
"id": "attr.f_opportunitysnapshot.oppsnapshot",
67+
"type": "label"
68+
}
69+
},
70+
"negativeSelection": true,
71+
"values": [
72+
"245519",
73+
"237519"
74+
]
75+
}
76+
}
77+
],
78+
"identifier": "AreaChart.arbitrary_filter_test",
79+
"properties": {
80+
"controls": {}
81+
},
82+
"sorts": [],
83+
"title": "AreaChart - arbitrary attribute filter test",
84+
"uri": "AreaChart.arbitrary_filter_test",
85+
"visualizationUrl": "local:area"
86+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"attributes": [
3+
{
4+
"label": {
5+
"identifier": {
6+
"id": "label.opportunity.id.name",
7+
"type": "label"
8+
}
9+
},
10+
"local_identifier": "a_label.opportunity.id.name"
11+
}
12+
],
13+
"filters": [
14+
{
15+
"positive_attribute_filter": {
16+
"_in": {
17+
"values": [
18+
"245519",
19+
"237519",
20+
"241519"
21+
]
22+
},
23+
"label": {
24+
"identifier": {
25+
"id": "attr.f_opportunitysnapshot.oppsnapshot",
26+
"type": "label"
27+
}
28+
}
29+
}
30+
},
31+
{
32+
"negative_attribute_filter": {
33+
"label": {
34+
"identifier": {
35+
"id": "attr.f_opportunitysnapshot.oppsnapshot",
36+
"type": "label"
37+
}
38+
},
39+
"not_in": {
40+
"values": [
41+
"245519",
42+
"237519"
43+
]
44+
}
45+
}
46+
}
47+
],
48+
"measures": [
49+
{
50+
"definition": {
51+
"measure": {
52+
"compute_ratio": false,
53+
"filters": [],
54+
"item": {
55+
"identifier": {
56+
"id": "aangOxLSeztu",
57+
"type": "metric"
58+
}
59+
}
60+
}
61+
},
62+
"local_identifier": "m_aangOxLSeztu"
63+
}
64+
]
65+
}

0 commit comments

Comments
 (0)