One of the most useful use cases is to be able to export CCC charts to images (png or svg) - either to allow a user the ability to download it, or to include it in Pentaho Reporting or any other of those tools
Here's an example of how it works. Imagine you develop for your users a great looking dashboard, almost as good looking as one of the UIs we develop :) :
(This was the dashboard we developed in a recent Ctools training course in Orlando, Pentaho headquarters)
As you can see, we went to some extent, exploring CCC capabilities, to fine tune the charts. Now we want to be able to use that line chart to PRD. Even though CGG does not have a UI and doesn't aim to be user friendly, CDE has a way to make the bridge to it, using some hidden features.
Going straight to the point. In CDE, press shift-G. That will open the CGG window (as a side reference, press shift-? to see other very useful keyboard shortcuts):
If you ever used this feature before, you'll notice this screen is a little different. We just added some more features, namely the ability to automatically get the url that generates that image from the outside - even I always struggled to find the right url. This is already available in the dev builds and will be released in the next stable version.
You'll be able to see that you can set some options there, namely the outputType, that currently can be either png or svg and you may need to change the server url if are developing in a sandbox and want to publish it to a server. I actually thought svg support was broken in PRD but just tested it and that seems to be fixed, so take advantage of that feature.
One other thing to note is that you must take care of authentication. Either you pass the extra arguments &userid=joe&password=password or you allow that url to be accessible with no password, or whatever.
If you save your dashboard and try that url, this is what you'll get:
This is what CGG is all about, and there's tons of engineering work underneath to allow this "simple step" to work with just one keystroke.
Now it's gets very obvious what to do. Open PRD, add an image component, and put that url (don't forget authentication)
You'll also want to check the blog post I did a while back about using CDA datasources in PRD. In the meanwhile, in recent versions of PRD (4.5 and above) you don't need to download the CDA datasources, all you need to do is enable the experimental features in Edit -> Preferences -> General -> Enable Experimental Features.
To render this report from the server, you'll need to copy to pentaho/WEB-INF/lib/ the file pentaho-reporting-engine-classic-extensions-cda-*.jar that you'll find in PRD library directory.
There's another feature of CGG. You can pass parameters to the query, by adding ¶mParameterName=ParameterValue to the url. And that can be exposed from PRD too.
Just create a prompt the usual way. On my sample, the parameter is called a month, and since the query is already on the dashboard too, I just need to select it to build the prompt in the prpt.
However, in order to make the call with the new parameter, we can't use the image component anymore, and use the image-field instead.
For that, we need to create a formula that will build that url. Here's the sample formula I used:
The URLENCODE function allows us to be sure that our parameters will reach the server properly. In the end, we should have a report looking like this:
Advanced topic: If you make reports with a lot of charts (you can even have cgg rendering a chart per line) you'll soon find out that your report starts to take a really long time to render. There's an explanation for it: PRD does a lot of passes to better determine the final layout. Since CGG doesn't support the HEAD request method, PRD won't get the appropriate info regarding cache, resulting in a bunch of requests for the image. Fortunately, Thomas Morgner allowed is a workaround to this issue, by changing a behavior in libloader. In your loader.properties file (located in WEB-INF/classes for the server or create it under prd/resources dir for the report designer) add the following lines:
# Controls the minimum time between HEAD requests regardless of
# the date -headers given by the response object.
# Fixes the date headers by simply using Date.now() as mod-date.This particular feature will be available in Pentaho Reporting 3.9.1 (or you'll have to compile your own)
# This will break the HTTP specs and thus it is disabled by default.
And this is what it looks from the Pentaho BI server: