GoodData | Developer Network

Filtering Embedded Reports & Dashboards via HTTP Parameters

by ZD (@zsvoboda)

NOTE: This article previews the functionality that we are going to release in the Release 56 (~ 7/18/2011). Let me know if you are interested in beta testing this functionality. I can invite you to a beta server.

The embedded reports can be filtered via a their IFrame URL parameters. This blogpost demonstrates the new functionality on a simple example.

We will start with a simple Salesforce report that shows opportunity amount sliced by the lead source and the opportunity stage.

Salesforce Report

Let’s grab the report’s embedding URL from the embed dialog. We will just cherry-pick the URL from the IFrame src attribute for now as we’ll put it directly to the browser.

https://secure.gooddata.com/reportWidget.html#project=/gdc/projects/Project4&report=/gdc/md/Project4/obj/20887

Report URL

We put the IFrame URL to the browser and the report appears in a separate tab.

Embedded Report

Now we want to filter the report by the StageName attribute. We need to first determine the unique identifier that we’ll use for identifying the attribute in the filter. To be precise, we’ll filter by something what we call label. The labels contain the human readable names. The attributes are technically just unique numbers. Most attributes have just one label. However there might be attributes with multiple labels (e.g. Person with a Firstname, Lastname, and SSN). The StageName has two labels and we will filter by the label that contains the stage name.

First, we need to enumerate all labels associated with the StageName attribute. Let’s go to the Manage section of the GoodData UI, select the Data tab and find the StageName attribute.

StageName

Note the /gdc/md/Project4/obj/738 suffix of the page’s URL. This is the GoodData metadata server’s URL of the StageName attribute. Every object has its own unique URL. Now we will take a look at the StageName’s definition in the gray pages. We’ll just append the StageName unique URL to the GoodData server’s URL https://secure.gooddata.com/gdc/md/Project4/obj/738 and open the result in the browser:

StageName Grey Pages

We can see that the StageName attribute has two labels (attributeDisplayForms) and that the identifier of the stage name label is label.opportunity.stagename.

Yes, I know that we need to display this information on the attribute’s page to avoid the harakiri above and we’ll do this ASAP.

Now once we have the label’s identifier, we can use it in our report embedding URL. The usage is pretty straightforward:

https://secure.gooddata.com/reportWidget.html?label.opportunity.stagename=Qualification#project=/gdc/projects/Project4&report=/gdc/md/Project4/obj/20887

Filtered Report

We can also filter by two StageName values. Please note that Closed Won value must be URL-encoded because it contains the space.

https://secure.gooddata.com/reportWidget.html?label.opportunity.stagename=Qualification&label.opportunity.stagename=Closed%20Won#project=/gdc/projects/Project4&report=/gdc/md/Project4/obj/20887

Filtered Report

Multiple conditions with the same label are joined with the OR logical operator. Multiple conditions with a different labels are ANDed.

https://secure.gooddata.com/reportWidget.html?label.opportunity.stagename=Closed%20Won&label.opportunity.leadsource=Partner#project=/gdc/projects/Project4&report=/gdc/md/Project4/obj/20887

Filtered Report

And least but not last, the same trick works with the embedded dashboards too!

blog comments powered by Disqus