Hi all, I am trying to flter iframe using dashboar...
# gooddata-cloud
g
Hi all, I am trying to flter iframe using dashboard commands and I am trying to use this in postMessage: "gdc": { "product": "dashboard", "event": { "name": "setFilterContext", "data": { "filters": [ { "absoluteDateFilter": { "dataSet": { "identifier": "Date" }, "from": "2022-01-01", "to": "2022-01-01" }, } ], }, "contextId": "context123" } } It is posting the message I guess, something is invoked but the dashboard is not filtered. What am I missing? I guess the issue is with Identifier and ContextId, what should I put there ?
j
Hi Goran, There could be a few things to check here. One, the identifier maybe has another name or you used a different identifier for the date. Or, you might be hitting a limitation when using multiple date filters. ou are currently not able to change filter contexts with postMessages if the dashboard contains multiple date filters. We intend to implement a fix for this in the future. More on the functionality can be found here: https://www.gooddata.com/docs/cloud/embed-visualizations/iframes/post-messages-for-dashboards/#CommunicatewithEmbeddedDa[…]Messages-setFilterContext Could you please verify this on your end, and let us know how you get on?
g
Hi @Joseph Heun I tried to find the identifiers using the layout of a workspace and found some, but I don't know if that is the correct way to find them. Also, does the absolute filter has to exist or with the postMessage I am creating one on the fly?
j
You can run a GET api call for the dashboard: https://www.gooddata.com/docs/cloud/api-and-sdk/api/api_reference_all/#operation/getEntity@AnalyticalDashboards, which will give you the identifiers used.
i
Hi @Goran Jakimovski, About your secondary question, filter doesn’t have to exist and it should be still applied even if the dashboard does not have any filters at all. And you can find more information about identifiers here.
g
Hi @Ivana Gasparekova, I have managed to get the object identifiers, however I am now struggling to find documentation on how to use app-defined filters with Web Components. I have a dropdown list outside of the embedded dashboard in Angular, and I am trying to send the selected value as a filter to the dashboard. The only thing I found for this is to add listeners to events, not to send a filter, or eventually I think that even for web components, I have to use the PostMessage to send filters. If there is another way to do this, please let me know
i
Hi @Goran Jakimovski, Please let me double-check this internally with our UI SDK experts, I will get back to you with more details as soon as possible.
g
Hi @Ivana Gasparekova, thnx but on another thread we fixed the issue with iframe, so I guess we are going to abandon the web components, but just in case if you get the documentation for this, please let me know. Tnx