Hi, I'm trying to use a filters array in a postMes...
# gooddata-cloud
a
Hi, I'm trying to use a filters array in a postMessage call, but it's not working when I include multiple filters. However, if I use an array with only a single filter (any of them), it works fine. const filters = [ { absoluteDateFilter: { dataset: { identifier: { id: "Date1", type: "dataset" } }, from: this.formatDate(dateRange[0]), to: this.formatDate(dateRange[1]) } }, { absoluteDateFilter: { dataset: { identifier: { id: "Date2", type: "dataset" } }, from: this.formatDate(dateRange[0]), to: this.formatDate(dateRange[1]) } }, { negativeAttributeFilter: { displayForm: { identifier: "TypeId", type: "displayForm" }, notIn: [], textFilter: true } } ]; const gdcMessage = { gdc: { product: "dashboard", event: { name: "setFilterContext", data: { filters: filters } } } }; // Sending the postMessage window.postMessage(gdcMessage, '*');
m
Hi Aleksandra, can you please provide me with the related Request ID / Trace ID so I can review our logs for you?
a
Hi @Michael Ullock, I managed to sort it out. It's because I was trying to apply two date filters. I received this error: "Only one date filter can exist on the dashboard." and I figured it out. Thanks for your reply :)
m
That’s great and thanks for letting me know the root cause 🙂
1