<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Analyse This &#187; Report Designer</title>
	<atom:link href="http://www.prashantraju.com/category/pentaho/report-designer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.prashantraju.com</link>
	<description>The Trials and Tribulations of a Data Analyst</description>
	<lastBuildDate>Wed, 13 Apr 2011 10:00:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Creating Dynamic Sizing Charts with Pentaho Report Designer.</title>
		<link>http://www.prashantraju.com/2010/05/tip_creating-dynamic-sizing-charts-with-pentaho-report-designer/</link>
		<comments>http://www.prashantraju.com/2010/05/tip_creating-dynamic-sizing-charts-with-pentaho-report-designer/#comments</comments>
		<pubDate>Mon, 17 May 2010 09:30:23 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visualisation]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=1392</guid>
		<description><![CDATA[Pentaho Report Designer&#8217;s (PRD) charting capability is great &#8211; it has numerous charts to choose from and the formatting is extremely flexible. However I did have a problem with charts represent large data sets. For example I had a list of countries and a bar chart showing the population for each country, users were able [...]]]></description>
			<content:encoded><![CDATA[<p>Pentaho Report Designer&#8217;s (PRD) charting capability is great &#8211;  it has numerous charts to choose from and the formatting is extremely flexible. However I did have a problem with charts represent large data sets. For example I had a list of countries and a bar chart showing the population for each country, users were able to view one or more countries at a time using a multi value list parameter. The problem occurred when there were too many countries, the chart&#8217;s labels became unreadable. One method was to create a chart which had a dynamic width depending on the amount countries a user selected.</p>
<p><span id="more-1392"></span></p>
<h3>Scenario.</h3>
<p>I wanted to create a bar chart which has a dynamic width (<em>expand or <img title="More..." src="http://www.prashantraju.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" />contract</em>) depending on the amount of categories a user selected from a multi value list parameter. This would ensure that the chart didn&#8217;t become squashed and unreadable. in this tutorial I will be using a data set which represents population by countries.</p>
<h3>Data Set.</h3>
<p>Below is an example of the data set I will be using for this tutorial, as you can see each country has a population (you can download a spreadsheet version of the sample data at the end of this tutorial).</p>
<table>
<tbody>
<tr>
<th>ID</th>
<th>COUNTRY</th>
<th>POPULATION*</th>
</tr>
<tr>
<td>1</td>
<td>China</td>
<td>1337490000</td>
</tr>
<tr>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
</tr>
</tbody>
</table>
<p>* Population is calculated in the millions</p>
<h3>Step 1 &#8211; Data Source.</h3>
<p>Start PRD and create a new report. Right click on the <strong>Data Sets</strong> icon and select the <strong>JDBC</strong> option from the menu.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/datasource_jdbc_option.png" target="_blank"><img class="alignnone size-thumbnail wp-image-1350" title="Data Source &gt; JDBC option" src="http://www.prashantraju.com/wp-content/uploads/2010/05/datasource_jdbc_option-150x150.png" alt="Data Source, JDBC option" width="150" height="150" /></a></p>
<p>After selecting the <strong>JDBC</strong> option a <strong>JDBC Data Source</strong> window will appear. I have already created a connection to my database which includes the data that I will be working on, in this example it is called <strong>Geography</strong>.</p>
<p><img class="alignnone size-full wp-image-1424" title="Geography Data Source" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-11.05.57-AM.png" alt="Geography Data Source" width="266" height="175" /></p>
<p>Once you have a working connection to your database you are now ready to create your queries.</p>
<h3>Step 2 &#8211; Queries.</h3>
<p>This report contains two separate queries:</p>
<ol>
<li><strong>qCountries </strong>: Retrieves a distinct list of countries, this will be used for the countries parameter</li>
<li><strong>qDataset</strong> : Retrieves the population for the countries selected by a user</li>
</ol>
<h4>pCountries.</h4>
<p>The <strong>qCountries</strong> query needs to return a distinct list of countries<strong>, </strong>the SQL query looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>   <span style="color: #993333; font-weight: bold;">DISTINCT</span> COUNTRY
<span style="color: #993333; font-weight: bold;">FROM</span>     dataset</pre></div></div>

<p>A screen shot of the <strong>JDBC Data Source</strong> window of the <strong>qCountries</strong> query looks like this:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-11.03.56-AM.png" target="_blank"><img class="alignnone size-medium wp-image-1423" title="qCountries" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-11.03.56-AM-300x211.png" alt="qCountries" width="300" height="211" /></a></p>
<h4>qDataset.</h4>
<p>The <strong>qDataset</strong> query needs to return the population for countries which the user has selected<strong>, </strong>the SQL query looks like this (this query will need to use a parameter which I will add in later):</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Use a sub query to calculate the total amount of countries selected</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>    t1<span style="color: #66cc66;">.</span>COUNTRY <span style="color: #993333; font-weight: bold;">AS</span> COUNTRY<span style="color: #66cc66;">,</span>
               SUM<span style="color: #66cc66;">&#40;</span>t1<span style="color: #66cc66;">.</span>POPULATION<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> POPULATION<span style="color: #66cc66;">,</span>
               SUM<span style="color: #66cc66;">&#40;</span>t2<span style="color: #66cc66;">.</span>COUNTRY_COUNT<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> COUNTRY_COUNT
<span style="color: #993333; font-weight: bold;">FROM</span>      dataset t1<span style="color: #66cc66;">,</span>
          <span style="color: #66cc66;">&#40;</span>
              <span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> COUNTRY_COUNT
              <span style="color: #993333; font-weight: bold;">FROM</span> dataset
              <span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> COUNTRY
          <span style="color: #66cc66;">&#41;</span> t2
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> COUNTRY</pre></div></div>

<p>A screen shot of the <strong>JDBC Data Source</strong> window with the <strong>qDataset</strong> query looks like this:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-16-at-12.17.37-AM.png" target="_blank"><img class="alignnone size-medium wp-image-1468" title="qDataset" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-16-at-12.17.37-AM-300x213.png" alt="qDataset" width="300" height="213" /></a></p>
<h3>Step 3 &#8211; Parameter.</h3>
<p>There is only one (multi value list) parameter in this report which will display a distinct list of countries and be populated by the <strong>qCountries </strong>query. To create a new parameter right click on the <strong>Parameters </strong>option under the <strong>Data </strong>tab and click the <strong>Add Parameter&#8230; </strong>option:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.06.19-AM.png" target="_blank"><img class="alignnone size-full wp-image-1407" title="Add Parameter..." src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.06.19-AM.png" alt="Add Parameter..." width="220" height="248" /></a></p>
<p>This will bring up the <strong>Add Parameter</strong> window. After filling out all the options the <strong>Add Parameter</strong> window now looks like this:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.13.43-AM.png" target="_blank"><img class="alignnone size-medium wp-image-1409" title="sCountries" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.13.43-AM-292x300.png" alt="sCountries" width="292" height="300" /></a></p>
<p>Where the options and values are:</p>
<ul>
<li><strong>Name</strong> : This is the name of the parameter, this is used within report queries i.e. the WHERE clause of qDataset</li>
<li><strong>Label </strong>: The text which sits next to the parameter on the report i.e. <em>Select one or more countries</em></li>
<li><strong>Value Type </strong>: The data type of the sCountries value i.e. COUNTRY is a String</li>
<li><strong>Mandatory </strong>: For the report to run a parameter value must be selected i.e. Checked (true)</li>
<li><strong>Display Type </strong>: The parameter type i.e. Multi Value List</li>
<li><strong>Value </strong>: The parameters value which will used within queries etc. i.e. the field COUNTRY</li>
<li><strong>Display Name </strong>: What the user will see the parameter value as i.e. the field COUNTRY</li>
<li><strong>Visible items </strong>: The amount of items which are shown to the user in the multi value list parameter i.e. 3</li>
</ul>
<p>Click <strong>OK</strong> to save the parameter, it should now be visible under the <strong>Parameters item</strong> under the <strong>Data</strong> tab.</p>
<p><img class="alignnone size-full wp-image-1410" title="sCountries Parameter" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.21.48-AM.png" alt="sCountries Parameter" width="238" height="104" /></p>
<p>After adding the <strong>sCountries </strong>parameter the next step is to use the parameter as part of the <strong>qDataset</strong> WHERE clause. Right click on the <strong>qDataset</strong> item under the <strong>Data</strong> tab and click the <strong>Edit Query </strong>option:</p>
<p><img class="alignnone size-full wp-image-1427" title="Edit Query" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-11.57.41-AM.png" alt="Edit Query" width="235" height="172" /></p>
<p>Modify the <strong>qDataset</strong> query so that it now includes the <strong>sCountries</strong> parameter:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Use a sub query to calculate the total amount of countries selected</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>    t1<span style="color: #66cc66;">.</span>COUNTRY <span style="color: #993333; font-weight: bold;">AS</span> COUNTRY<span style="color: #66cc66;">,</span>
               SUM<span style="color: #66cc66;">&#40;</span>t1<span style="color: #66cc66;">.</span>POPULATION<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> POPULATION<span style="color: #66cc66;">,</span>
               SUM<span style="color: #66cc66;">&#40;</span>t2<span style="color: #66cc66;">.</span>COUNTRY_COUNT<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> COUNTRY_COUNT
<span style="color: #993333; font-weight: bold;">FROM</span>      dataset t1<span style="color: #66cc66;">,</span>
          <span style="color: #66cc66;">&#40;</span>
              <span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> COUNTRY_COUNT
              <span style="color: #993333; font-weight: bold;">FROM</span> dataset
              <span style="color: #993333; font-weight: bold;">WHERE</span> COUNTRY <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#123;</span>sCountries<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> COUNTRY
          <span style="color: #66cc66;">&#41;</span> t2
<span style="color: #993333; font-weight: bold;">WHERE</span> COUNTRY <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#123;</span>sCountries<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> COUNTRY</pre></div></div>

<p><a href="../wp-content/uploads/2010/05/Screen-shot-2010-05-16-at-12.14.17-AM.png" target="_blank"><img title="qDataset" src="../wp-content/uploads/2010/05/Screen-shot-2010-05-16-at-12.14.17-AM-300x223.png" alt="qDataset" width="300" height="223" /></a></p>
<h3>Step 4 &#8211; Bar Chart.</h3>
<p>The next step is to create a bar chart whose width is dynamic based on the amount of countries a user selects. To get started drag and drop the chart object onto the report header.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.27.11-AM.png" target="_blank"><img class="alignnone size-medium wp-image-1413" title="Bar Chart on Report Header" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.27.11-AM-300x187.png" alt="Bar Chart on Report Header" width="300" height="187" /></a></p>
<p>As you can see the width is fixed at the moment but before I start to make any changes to the chart&#8217;s width I will need to configure my chart to display our data and see how it becomes unreadable when we increase the amount of categories on the x axis. Double click on the chart and to bring up the <strong>Edit Chart </strong>window.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.29.34-AM.png" target="_blank"><img class="alignnone size-medium wp-image-1414" title="Edit Chart" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.29.34-AM-300x199.png" alt="Edit Chart" width="300" height="199" /></a></p>
<p>By default the chart is set to a bar chart and without going through every available option I made the following changes to represent my data set:</p>
<ul>
<li><strong>chart-title</strong> : Chart title i.e. Population of Countries (optional)</li>
<li><strong>gridlines</strong> : Are the vertical and horizontal grid markers i.e. Set to False (optional)</li>
<li><strong>x-axis</strong><strong>-title</strong> : Label of the x-axis i.e Countries</li>
<li><strong>x-axis</strong><strong>-label-rotation<strong> </strong></strong>: Rotation of the x-axis label i.e. 90</li>
<li><strong>y-axis</strong><strong>-title</strong> : Label of the y-axis i.e. Population (millions)</li>
<li><strong>category-column</strong><strong> </strong>: Field which will be on the x-axis i.e. COUNTRY</li>
<li><strong>value-columns</strong><strong> </strong> : Field which populates the y-axis i.e. POPULATION</li>
<li><strong>series-by-field</strong> : Field which defines the series i.e. COUNTRY</li>
</ul>
<p>After previewing the chart with all the countries selected you can see that the output is squashed and unreadable.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-12.30.08-PM1.png" target="_blank"><img class="alignnone size-medium wp-image-1433" title="Preview Non Dynamic Chart" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-12.30.08-PM1-300x127.png" alt="Preview Non Dynamic Chart" width="300" height="127" /></a></p>
<p>One way around this is to make the width (or height) of your chart dynamic by the amount of countries the user selects from the multi value list parameter. Select the chart and on the right hand side under the <strong>Style</strong> tab locate the <strong>size &amp; position </strong>option and click the <img class="alignnone size-full wp-image-688" style="padding: 0; margin: 0; border: none;" title="Plus Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/plus_icon.jpg" alt="Add a new query icon" width="15" height="15" /> icon under the <strong>Formula</strong> column. This will display an <strong>Expression </strong>window, click on the <img class="alignnone size-full wp-image-1434" style="padding: 0; margin: 0; border: none;" title="Screen shot 2010-05-15 at 1.35.05 PM" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.35.05-PM.png" alt="" width="32" height="20" /> icon which will then open the <strong>Formula Editor</strong> window.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.37.51-PM.png" target="_blank"><img class="alignnone size-medium wp-image-1436" title="Formula Editor" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-1.37.51-PM-300x169.png" alt="Formula Editor" width="300" height="169" /></a></p>
<p>The formula below retrieves the COUNTRY_COUNT field and multiplies it by the width of the chart which suits one category (country) on the x axis, which in this example is 150.</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># If there is only one country selected then use default width otherwise calculate width</span>
<span style="color: #000000;">=</span>IF<span style="">&#40;</span><span style="">&#91;</span>COUNTRY_COUNT<span style="">&#93;</span><span style="color: #000000;">=</span><span style="">1</span>;<span style="">150</span>;<span style="">&#91;</span>COUNTRY_COUNT<span style="">&#93;</span>*<span style="">150</span><span style="">&#41;</span></pre></div></div>

<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-9.20.29-PM.png" target="_blank"><img class="alignnone size-medium wp-image-1449" title="Width Formula" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-9.20.29-PM-300x177.png" alt="Width Formula" width="300" height="177" /></a></p>
<p>Save the formula. Now you are ready to preview the report.</p>
<h3>Step 5 &#8211; Preview.</h3>
<p>Click on the preview icon <img class="alignnone size-full wp-image-723" style="padding: 0px; margin: 0px; border: none;" title="Preview Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/preview_icon.jpg" alt="Preview icon" width="26" height="26" /> and select one country from the multi value list parameter, as you can see the width is set to our default width, 150.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-10.51.17-PM.png" target="_blank"><img class="alignnone size-medium wp-image-1457" title="1 Parameter" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-10.51.17-PM-300x137.png" alt="1 Parameter" width="300" height="137" /></a></p>
<p>Selecting two countries from the multi value list parameter will expand the width to 300.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-10.51.37-PM.png" target="_blank"><img class="alignnone size-medium wp-image-1458" title="2 Parameters" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-10.51.37-PM-300x135.png" alt="2 Parameters" width="300" height="135" /></a></p>
<p>Selecting four countries from the multi list parameter will expand the width to 600.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-10.52.34-PM.png" target="_blank"><img class="alignnone size-medium wp-image-1459" title="4 Parameters" src="http://www.prashantraju.com/wp-content/uploads/2010/05/Screen-shot-2010-05-15-at-10.52.34-PM-300x136.png" alt="4 Parameters" width="300" height="136" /></a></p>
<p>So that is how you create a chart which can expand or contract depending on the amount of categories displayed on the x axis.</p>
<h3>Downloads.</h3>
<table>
<tbody>
<tr>
<th>Filename</th>
<th>Type</th>
<th>Notes</th>
</tr>
<tr>
<td><a href="http://docs.google.com/leaf?id=0B9Jmocc0fj_EYjg1MTM2YTEtYzhjZi00N2Y1LTg5YmQtNTg2ZWU0Mjg3Zjhl&amp;hl=en" target="_blank">DynamicChartsData</a></td>
<td>ODS</td>
<td>Released 17/05/2010</td>
</tr>
<tr>
<td><a href="http://docs.google.com/leaf?id=0B9Jmocc0fj_EOGMxMjRhZmYtOGIzMS00NmNlLTgzNjAtMTNlNWZiMGE0MDcz&amp;hl=en" target="_blank">DynamicCharts</a></td>
<td>PRPT</td>
<td>Released 17/05/2010</td>
</tr>
</tbody>
</table>
<h3>Final Notes.</h3>
<p>A couple of things to note about the method I used:</p>
<ul>
<li>The query to generate the amount of selected countries uses a sub query and could cause performance issues with large data sets etc.</li>
<li>This method can be used for both the width and height and on any other object within PRD i.e. shapes, labels, pictures etc.</li>
</ul>
<p>Hopefully this comes in handy when you start handling large data sets and charts!</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/05/tip_creating-dynamic-sizing-charts-with-pentaho-report-designer/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tip: Displaying Multi Parameter Values with Pentaho Report Designer.</title>
		<link>http://www.prashantraju.com/2010/04/displaying-multi-parameter-values-with-pentaho-report-designer/</link>
		<comments>http://www.prashantraju.com/2010/04/displaying-multi-parameter-values-with-pentaho-report-designer/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 13:14:52 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=1240</guid>
		<description><![CDATA[Multi list parameters (multi list values and multi selection buttons) are a great way of letting a user filter a report on one or more values at once. Recently I came across a situation where I had to display these values in a friendly format. This tip will outline a method I used to display [...]]]></description>
			<content:encoded><![CDATA[<p>Multi list parameters (multi list values and multi selection buttons) are a great way of letting a user filter a report on one or more values at once. Recently I came across a situation where I had to display these values in a friendly format. This tip will outline a method I used to display friendly formatted parameter values of a multi list parameter inside a report using Pentaho Report Designer 3.6.</p>
<p><span id="more-1240"></span></p>
<p>My current report (based on the Steel Wheels sample data) displays the product code and product name based on multiple selections of product codes using a multi value list parameter type:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-9.55.06-PM.png"><img class="alignnone size-medium wp-image-1247" title="Pentaho Report Designer Preview" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-9.55.06-PM-300x151.png" alt="Pentaho Report Designer Preview" width="300" height="151" /></a></p>
<p>To populate the above report I use the following queries:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Name: product</span>
<span style="color: #808080; font-style: italic;">-- Description: Populates the main report</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>
  PRODUCTCODE<span style="color: #66cc66;">,</span> PRODUCTNAME
<span style="color: #993333; font-weight: bold;">FROM</span>
  PRODUCTS
<span style="color: #993333; font-weight: bold;">WHERE</span>
  PRODUCTCODE <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#123;</span>productCodes<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Name: productsList</span>
<span style="color: #808080; font-style: italic;">-- Description: Populates the product code parameter</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>
  <span style="color: #993333; font-weight: bold;">DISTINCT</span> PRODUCTCODE
<span style="color: #993333; font-weight: bold;">FROM</span>
  PRODUCTS</pre></div></div>

<p>The options for the product code multi value list parameter are:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-9.44.59-PM.png"><img class="alignnone size-medium wp-image-1246" title="Parameter Options" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-9.44.59-PM-284x300.png" alt="Parameter Options" width="284" height="300" /></a></p>
<p>Now I need to display the multi list parameter values (product codes) in the report header but formatted like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">S10_1678, S10_1949, S10_2016</pre></div></div>

<p>To create the above format I&#8217;m going to use MySQL&#8217;s <strong>GROUP_CONCAT</strong> function (there are similar functions out there for PostgreSQL, Oracle, SQL Server etc.) in a new query. The query which uses the GROUP_CONCAT function looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">-- Name: productsSelected</span>
<span style="color: #808080; font-style: italic;">-- Description: Displays a friendly formatted list of parameters inside the sub-report using the productCodes parameter</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span>
  GROUP_CONCAT<span style="color: #66cc66;">&#40;</span>PRODUCTCODE<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">', '</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span>
  PRODUCTS
<span style="color: #993333; font-weight: bold;">WHERE</span>
  PRODUCTCODE <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>$productCodes<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>As this is a separate query I will need to create an <strong>inline</strong> sub-report. The first step is to drag and drop the sub-report object from the left pane onto the report-header and assign the <strong>productsSelected</strong> query:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.35.09-PM.png"><img class="alignnone size-medium wp-image-1257" title="Assigned the productSelected query to the sub-report" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.35.09-PM-300x193.png" alt="Assigned the productSelected query to the sub-report" width="300" height="193" /></a></p>
<p>The next step is to double click on the sub-report to work inside it. Once the sub-report has opened under the <strong>Data</strong> tab right click on the <strong>Parameters</strong> item and select the <strong>Edit Sub-report Parameters&#8230;</strong> option. From the <strong>Sub-report parameters</strong> window add in the productCode parameter under the <strong>Import Parameters</strong> area (Outer and Inner) and click <strong>OK</strong> to save.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.39.24-PM.png"><img class="alignnone size-medium wp-image-1258" title="Sub-report Parameters Window" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.39.24-PM-300x176.png" alt="Sub-report Parameters Window" width="300" height="176" /></a></p>
<p>To display the multi value list field (GROUP_CONCAT(PRODUCTCODE, &#8216;, &#8216;)), I dragged and dropped the field from the <strong>productsSelected</strong> query under the <strong>Data</strong> tab onto the report header section and also added a label <em>Selected Product Codes</em>:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.43.18-PM.png"><img class="alignnone size-medium wp-image-1260" title="Report Header with Parameter Values" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.43.18-PM-300x99.png" alt="Report Header with Parameter Values" width="300" height="99" /></a></p>
<p>After the previewing the report I can now see that the parameters from the multi value list are displayed in a friendly format:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.45.29-PM.png"><img class="alignnone size-medium wp-image-1261" title="Preview" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-14-at-10.45.29-PM-300x201.png" alt="Preview" width="300" height="201" /></a></p>
<p>This method does have a downfall as it runs another query but it is a simple and clean way of outputting the values of multi value list parameters.</p>
<table>
<thead>
<tr>
<th>Filename</th>
<th>Type</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://docs.google.com/leaf?id=0B9Jmocc0fj_EYTBkZTFmNjgtMGNjZS00MzliLWJhYzctM2RlM2YwZmJjZDk5&amp;hl=en" target="_blank">MultiValueListParameters</a></td>
<td>PRPT</td>
<td>Released 14/04/2010</td>
</tr>
<tr>
<td><a href="https://docs.google.com/fileview?id=0B9Jmocc0fj_EZDA2MTY4YWYtOGY2OC00YzVkLWIzM2YtMGEwMTM5OGE0NDI0&amp;hl=en" target="_blank">MultiValueListParametersPreview</a></td>
<td>PDF</td>
<td>Released 14/04/2010</td>
</tr>
</tbody>
</table>
<p>Do you use a different method? Let me know by posting a comment!</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/04/displaying-multi-parameter-values-with-pentaho-report-designer/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Pentaho Report Designer and Excel Data Sources.</title>
		<link>http://www.prashantraju.com/2010/04/pentaho-report-designer-and-excel-data-sources/</link>
		<comments>http://www.prashantraju.com/2010/04/pentaho-report-designer-and-excel-data-sources/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 03:23:57 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Visualisation]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=1097</guid>
		<description><![CDATA[Last week I had a regular Excel/Access user approach me with a problem: I have 40 sale campaigns. I need to put together a quick presentation (as a PDF) which will show 2 key metrics (New and Loss revenue) for each of the 40 sale campaigns. Do you know of a quick way I can [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I had a regular Excel/Access user approach me with a problem:</p>
<blockquote><p>I have 40 sale campaigns. I need to put together a quick presentation (as a PDF) which will show 2 key metrics (New and Loss revenue) for each of the 40 sale campaigns. Do you know of a quick way I can produce this presentation?</p></blockquote>
<p>I thought this would the perfect opportunity to show off Pentaho Report Designer (PRD) as an alternative to Mircosoft Excel, Access or other big BI vendors. Below is a step by step guide on how I accomplished this.</p>
<p><span id="more-1097"></span></p>
<h3>Scenario.</h3>
<p>The above statement sums up the users requirements, visually the the report needed to look like this:</p>
<p><img class="alignnone size-full wp-image-1167" title="Report Structure" src="http://www.prashantraju.com/wp-content/uploads/2010/04/report_structure1.jpg" alt="Report Structure" width="311" height="190" /></p>
<p>After I knew the structure of the report I got the user to export the data into an Excel Worksheet &#8211; this was going to be my data source &#8211; after this it took me only 5 minutes to create the presentation using PRD.</p>
<h3>Data Source.</h3>
<p>The end user was able to produce a raw extract of the data which the report needed to be based on. Here is a preview of the data:</p>
<table>
<thead>
<tr>
<th>Campaign</th>
<th>Week_Ending</th>
<th>New_09</th>
<th>New_10</th>
<th>Loss_09</th>
<th>Loss_10</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>04/04/2010</td>
<td>12313</td>
<td>23423</td>
<td>34534</td>
<td>3463</td>
</tr>
<tr>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
</tr>
</tbody>
</table>
<ul>
<li><strong>Campaign</strong>: Campaign identifier which duplicates for each week row</li>
<li><strong>Week</strong>: Week ending date which is for 2010</li>
<li><strong>New_09, Loss_09:</strong> Revenue for 2009</li>
<li><strong>New_10, Loss_10</strong>: Revenue for 2010</li>
</ul>
<p>To use an Excel worksheet as a data source make sure the <strong>Data</strong> tab is active, right click on the <strong>Data Sets</strong> icon and select the <strong>Table</strong> option:</p>
<p><img class="alignnone size-full wp-image-1153" title="Table Data Source" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource.jpg" alt="Table Data Source (Data &gt; Data Sets &gt; Table)" width="285" height="269" /></p>
<p>After clicking the <strong>Table</strong> option a <strong>Table Datasource Editor</strong> window is displayed:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor.jpg"><img class="alignnone size-medium wp-image-1154" title="Table Datasource Editor" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor-300x282.jpg" alt="Table Datasource Editor Window" width="300" height="282" /></a></p>
<h4><strong>Step 1. Create a Query.</strong></h4>
<p>The first step is to create a query which will store the data set. Click on the <img class="alignnone size-full wp-image-688" title="Plus Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/plus_icon.jpg" alt="Add a new query icon" width="15" height="15" /> (Add Query) icon and then specify a name, in this example I&#8217;m naming the query <strong>dataset</strong>.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_New.jpg"><img class="alignnone size-medium wp-image-1155" title="Table Datasource Editor New Query" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_New-300x282.jpg" alt="Table Datasource Editor New Query" width="300" height="282" /></a></p>
<h4><strong>Step 2. Select the Excel Worksheet.</strong></h4>
<p>The next step is to select the Excel worksheet which contains the data set. Click on  the <img class="alignnone size-full wp-image-1127" title="Table Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Screen-shot-2010-04-07-at-11.04.45-PM.png" alt="Table Icon" width="44" height="38" /> icon located in the bottom left hand corner to open up a file browser window, select the Excel file which contains the data set and click <strong>OK</strong>. Your data set should now be visible (as my Excel worksheet has headers I have checked the <strong>Use First Row as  Header</strong> option).</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_Pre.jpg"><img class="alignnone size-medium wp-image-1156" title="Table Datasource Editor Preview Data" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_Pre-300x282.jpg" alt="Table Datasource Editor Preview Data" width="300" height="282" /></a></p>
<p class="notice">At the moment you can only use .XLS files so if you are using Office 2007+ make sure you save the extension as .XLS instead of .XLSX <strong>and </strong>if your .XLS file contains formulas they will not be recognised by PRD so be sure to paste special as values.</p>
<h4><strong><strong>Step 3. Manipulate the Data.</strong></strong></h4>
<p>You can add empty rows and columns or remove rows and columns by using these icons:</p>
<p><img class="alignnone size-full wp-image-1157" title="Modify the Dataset" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_Edi.jpg" alt="Modify the Dataset" width="322" height="45" /></p>
<p>You are also able to change the column headers and data type by double clicking on the column header:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_Col.jpg"><img class="alignnone size-medium wp-image-1158" title="Table Datasource Editor - Modify Column Data Types and Names" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Table_Datasource_Editor_Col-300x282.jpg" alt="Table Datasource Editor - Modify Column Data Types and Names" width="300" height="282" /></a></p>
<p class="notice">In this example I didn&#8217;t need to make any modifications to the data however I did have trouble converting the Week_Ending field into a date format so in the Excel worksheet I converted it into a string using the TEXT() function &#8211; if anyone knows how to get this working please lleave a comment.</p>
<p>Once you are happy with the data set click the <strong>OK</strong> button. The data set should now be visible as fields under the <strong>Data Sets</strong> &gt; <strong>Table &gt; dataset</strong> icon under the <strong>Data</strong> tab:</p>
<p><img class="alignnone size-full wp-image-1159" title="Data Sets Fields" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Data_Sets_Fields.jpg" alt="Data Sets Fields" width="314" height="210" /></p>
<h3>Building the Report.</h3>
<p>The next step was to build the report, from the report structure (above) I knew I had to create one group Campaign, and within that group add 2 charts which represented the New and Loss Revenue for 2009 and 2010.</p>
<h4><strong>Step 1. Add the Group.</strong></h4>
<p>To get started add the <strong>Campaign</strong> field as a group by right clicking on the <strong>Groups</strong> item under the <strong>Structure</strong> tab and selecting the <strong>Edit Group</strong> .. option:</p>
<p><img class="alignnone size-full wp-image-1160" title="Edit Group Option" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Edit_Group.jpg" alt="Edit Group Option" width="314" height="210" /></p>
<p>After clicking the <strong>Edit Group ..</strong> option an <strong>Add Group </strong>window will appear, specify a name for the group i.e. Campaign and using the arrows move the field over which defines the group which in this example is Campaign and click <strong>OK</strong> when done.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Add_Group.jpg"><img class="alignnone size-medium wp-image-1161" title="Add Group Window" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Add_Group-300x150.jpg" alt="Add Group Window" width="300" height="150" /></a></p>
<p>The Campaign field will now be defined under the <strong>Attributes</strong> tab for the <strong>Group</strong> <strong>item</strong>:</p>
<p><img class="alignnone size-full wp-image-1162" title="Campaign Group Attributes" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Campaign_Group_Attr.jpg" alt="Campaign Group Attributes" width="314" height="210" /></p>
<p>The next step is to make the <strong>Group Header </strong>and <strong>Details Header </strong>are visible on the report canvass. Click on the <strong>Groups</strong> &gt; <strong>Group</strong> <strong>Header</strong> item under the <strong>Structure</strong> tab and and under the <strong>Attributes</strong> tab uncheck the <strong>hide-on-canvass</strong> option:</p>
<p><img class="alignnone size-full wp-image-1163" title="Group Header Visible" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Group_Header_Visible.jpg" alt="Group Header Visible" width="314" height="210" /></p>
<p>Repeat the above steps for the <strong>Groups &gt; Details Body &gt; Details Header </strong>item as well:</p>
<p><img class="alignnone size-full wp-image-1164" title="Details Header Visible" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Details_Header_Visible.jpg" alt="Details Header Visible" width="314" height="210" /></p>
<h4><strong><strong>Step 2. Functions.</strong></strong></h4>
<p>I will need to create three functions; one which will convert the Week_Ending field into a date and the other two will be display dynamic chart titles.</p>
<h5><strong>Converting the Date.</strong></h5>
<p>As I mentioned above I had some issues with letting PRD convert the Week_Ending field into a date from the Table Datasource Editor, so to get around this I created a formula which would take the Week_Ending field (as a string) and convert it into a Date.</p>
<p>To do this create a new function by right clicking on the <strong>Functions </strong>option under the <strong>Data</strong> tab and click the <strong>Add Function&#8230;</strong> option.</p>
<p><img class="alignnone size-full wp-image-1168" title="Add Function Menu Option" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Add_Fucntion_Option.jpg" alt="Add Function Menu Option" width="314" height="210" /></p>
<p>From the<strong> Add Function&#8230;</strong> window expand the<strong> Common</strong> folder and select the<strong> Open Formula</strong> option and click the <strong>Add </strong>button:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Add_Function_Open_Form.jpg"><img class="alignnone size-medium wp-image-1169" title="Add Function Open Formula" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Add_Function_Open_Form-300x154.jpg" alt="Add Function Open Formula" width="300" height="154" /></a></p>
<p>This will add an <strong>Open Formula</strong> function under the <strong>Functions </strong>option (seen under the <strong>Data</strong> tab) :</p>
<p><img class="alignnone size-full wp-image-1170" title="New Open Formula Created" src="http://www.prashantraju.com/wp-content/uploads/2010/04/New_Open_Formula_Created.jpg" alt="New Open Formula Created" width="314" height="210" /></p>
<p>To change the name of the function (named by default as FormulaExpression1) click on the function and in the area below change the value that is set for the <strong>Function Name</strong>, in this example I named the function New_Week_Ending:</p>
<p><img class="alignnone size-full wp-image-1171" title="New Function Name" src="http://www.prashantraju.com/wp-content/uploads/2010/04/New_Function_Name.jpg" alt="New Function Name" width="314" height="210" /></p>
<p>To edit the formula of the function click on the <img class="alignnone size-full wp-image-1172" title="Dot Dot Dot" src="http://www.prashantraju.com/wp-content/uploads/2010/04/dotdotdot.jpg" alt="Dot Dot Dot" width="19" height="15" /> icon which is displayed when you click in the <strong>Formula </strong>value area, this will display a <strong>Formula Editor</strong> window:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Formula_Editor.jpg"><img class="alignnone size-medium wp-image-1173" title="Formula Editor Window" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Formula_Editor-300x136.jpg" alt="Formula Editor Window" width="300" height="136" /></a></p>
<p>As my date is in the current format YYYY-MM-DD I needed to use the DATE function with a combination of LEFT, MID and RIGHT functions to convert it into a date. I won&#8217;t go into too much detail with this section as all these functions are pretty self explanatory and are well documented in the Formula Editor but the final formula looked like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">=DATE(LEFT([Week_Ending];4);MID([Week_Ending];6;2);RIGHT([Week_Ending];2))</pre></div></div>

<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Formula_Editor_Window.jpg"><img class="alignnone size-medium wp-image-1175" title="Date Formula inside Formula Editor" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Formula_Editor_Window-300x182.jpg" alt="Date Formula inside Formula Editor" width="300" height="182" /></a></p>
<p>Click the <strong>OK </strong>button to save the New_Week_Ending formula. I have just created a function which will convert the Week_Ending (string) field into a New_Week_Ending (date) field so that the X-Y Chart TimeSeries Collector will now recognise it as a date.</p>
<h5><strong><strong>Dynamic Chart Titles.</strong></strong></h5>
<p>Each chart needs to have a dynamic title which will output the campaign and the measure which is represented i.e. 1 &#8211; New Revenue ($). As I have two charts for each campaign I will need to create two functions: one for the New Revenue chart and one for the Loss Revenue chart.</p>
<p>Following the steps outlined above to create two new functions (with the names sNewChart and sLossChart) using the <strong>Open Formula</strong> type and specify the formulas to be:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># New Revenue Charts (sNewChart)</span>
<span style="color: #000000;">=</span><span style="">&#91;</span>Campaign<span style="">&#93;</span> &amp; <span style="color: #933;">&quot; - New Revenue ($)&quot;</span>
<span style="color: #808080; font-style: italic;"># Loss Revenue Charts (sLossChart)</span>
<span style="color: #000000;">=</span><span style="">&#91;</span>Campaign<span style="">&#93;</span> &amp; <span style="color: #933;">&quot; - Loss Revenue ($)&quot;</span></pre></div></div>

<p>I have now created three functions:</p>
<p><img class="alignnone size-full wp-image-1183" title="Three New Functions" src="http://www.prashantraju.com/wp-content/uploads/2010/04/three_new_func.jpg" alt="Three New Functions" width="314" height="210" /></p>
<h4><strong>Step 2. Add the Group Header.</strong></h4>
<p>To add the Campaign as the Group Header drag and drop the <strong>Campaign</strong> field from the <strong>Data </strong>tab onto the <strong>Group Header</strong> area and apply some formatting:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Group_Header_Campaign.jpg"><img class="alignnone size-medium wp-image-1176" title="Group Header with Campaign " src="http://www.prashantraju.com/wp-content/uploads/2010/04/Group_Header_Campaign-300x206.jpg" alt="Group Header with Campaign " width="300" height="206" /></a></p>
<h4><strong><strong>Step 3. Add the Charts.</strong></strong></h4>
<p>Each chart needed to look similar to this mockup (I have already created the Chart Title and New_Week_Ending functions):</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/chart_structure1.jpg"><img class="alignnone size-full wp-image-1182" title="Chart Structure" src="http://www.prashantraju.com/wp-content/uploads/2010/04/chart_structure1.jpg" alt="Chart Structure" width="383" height="300" /></a></p>
<p>Drag and drop a chart object <a href="http://www.prashantraju.com/wp-content/uploads/2010/04/chart_icon.jpg"><img title="Chart Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/04/chart_icon.jpg" alt="Chart Icon" width="22" height="18" /></a> from the panel located on the left hand side onto the <strong>Details Header</strong> section and double click the object to open up the<strong> Edit Chart</strong> (properties) window . To create a<strong> X-Y Chart </strong>which uses a <strong>TimeSeries Collector</strong> make sure you <strong>Edit Chart</strong> (properties) window looks like this:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Edit_Chart_Properties.jpg"><img class="alignnone size-medium wp-image-1181" title="Edit Chart Properties" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Edit_Chart_Properties-300x155.jpg" alt="Edit Chart Properties" width="300" height="155" /></a></p>
<p>After setting up all the options the <strong>Edit Chart</strong> (properties) window now look like this (for the New Revenue measure):</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Chart_Prop_Setup.jpg"><img class="alignnone size-medium wp-image-1185" title="Chart Properties for New Revenue Measure" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Chart_Prop_Setup-300x207.jpg" alt="Chart Properties for New Revenue Measure" width="300" height="207" /></a></p>
<ul>
<li><strong>Title</strong>
<ul>
<li><strong>chart-title-field:</strong> Field or function which is the chart title i.e. sNewChart or sLossChart</li>
</ul>
</li>
<li><strong>Primary DataSource</strong>
<ul>
<li><strong>Common<br />
</strong></p>
<ul>
<li><strong>category-time-option</strong>: Value of the x-axis, this must match the amount of series you have in the value-column option i.e. New_Week_Ending (twice)</li>
<li><strong>time-period-type</strong>: Type of period the above field is i.e. Week and New_Week_Ending is an increment of weeks</li>
<li><strong>value-column</strong>: Field(s) which contain the y-axis, you can specify more than one as there can be multiple series i.e. New_09 and New_10 or Loss_09 and Loss_10</li>
</ul>
</li>
<li><strong>Series</strong>
<ul>
<li><strong>series-by-value:</strong> Name of the each series specified for the above option i.e. 2009 and 2010</li>
</ul>
</li>
<li><strong>Group</strong>
<ul>
<li><strong>reset-group:</strong> Reset the charts after a specific group(s) i.e. Campaign</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>There was alot of extra formatting on the charts so be sure to check out the available .PRPT file if you interested in what they look like.</p>
<p>After I created the chart for New Revenue I just copied and pasted the chart object and made changes to the properties to create the Loss Revenue chart:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/Loss_revenue_chart_prop.jpg"><img class="alignnone size-medium wp-image-1188" title="Loss Revenue Chart Properties" src="http://www.prashantraju.com/wp-content/uploads/2010/04/Loss_revenue_chart_prop-300x207.jpg" alt="Loss Revenue Chart Properties" width="300" height="207" /></a></p>
<p>The final report structure looks like this:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/report_structure_complete.jpg"><img class="alignnone size-medium wp-image-1189" title="Report Structure Complete" src="http://www.prashantraju.com/wp-content/uploads/2010/04/report_structure_complete-300x182.jpg" alt="Report Structure Complete" width="300" height="182" /></a></p>
<p class="success">There are a lot of options in the charting library of PRD so I suggest you pick up Will Gorman&#8217;s book <a href="http://www.amazon.com/gp/product/1847193196/ref=oss_product" target="_blank">Pentaho Reporting 3.5 for Java Developers</a> which has a couple of chapters which cover the charting library in detail.</p>
<h4><strong><strong><strong><strong>Step 4. Add the Page Break.</strong></strong></strong></strong></h4>
<p>The last step was to add a page break after each Campaign group. To do this click on the <strong>Details Body</strong> item under the <strong>Structure </strong>tab and check the <strong>pagebreak-after </strong>option:</p>
<p><img class="alignnone size-full wp-image-1191" title="Page Break" src="http://www.prashantraju.com/wp-content/uploads/2010/04/page_break.jpg" alt="Page Break" width="314" height="210" /></p>
<h3>Output.</h3>
<p>After previewing the report the final output as a PDF looks like this (you can download the actual PDF file below):</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/04/preview.jpg"><img class="alignnone size-medium wp-image-1194" title="Preview" src="http://www.prashantraju.com/wp-content/uploads/2010/04/preview-300x241.jpg" alt="Preview" width="300" height="241" /></a></p>
<h3>Downloads.</h3>
<table>
<thead>
<tr>
<th>Filename</th>
<th>Type</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://docs.google.com/leaf?id=0B9Jmocc0fj_EM2QzYTc5ZWYtYTIwMC00Mjk3LTkzNTYtZmVlMjZjNzkxNDUx&amp;hl=en" target="_blank">ExcelDataSource</a></td>
<td>PRPT</td>
<td>Released 8/04/2010</td>
</tr>
<tr>
<td><a href="https://docs.google.com/fileview?id=0B9Jmocc0fj_EODdmMmEyMzItZWEwNS00MzgxLWI4M2QtN2Y5NmQwYWZhZTlh&amp;hl=en" target="_blank">ExcelDataSourceSampleData</a></td>
<td>XLS</td>
<td>Released 8/04/2010</td>
</tr>
<tr>
<td><a href="https://docs.google.com/fileview?id=0B9Jmocc0fj_EYjUzYjZkZWYtNTVjOS00OGU5LWE1ZjYtNjJkOTkyNmVkODYw&amp;hl=en" target="_blank">ExcelDataSourcePreview</a></td>
<td>PDF</td>
<td>Released 8/04/2010</td>
</tr>
</tbody>
</table>
<h3>Final Notes.</h3>
<p>This post is very detailed as it covers some interesting areas but as this was an ad hoc request it took me under 5 minutes to whip together this report and have it in the user&#8217;s inbox. Do you have any examples of how you handled ad hoc requests with PRD? If so, leave a comment or send me an <a href="mailto:prashant.g.raju@gmail.com">email</a>.</p>
<p>One user converted <em>n</em> to go! Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/04/pentaho-report-designer-and-excel-data-sources/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Creating Cascade Parameters with Pentaho Report Designer 3.5.</title>
		<link>http://www.prashantraju.com/2010/02/creating-cascade-parameters-with-pentaho-report-designer-3-5/</link>
		<comments>http://www.prashantraju.com/2010/02/creating-cascade-parameters-with-pentaho-report-designer-3-5/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 14:05:00 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=878</guid>
		<description><![CDATA[Cascade parameters provide a way of managing large amounts of data in reports. You can define a set of related parameters so that the list of values for one parameter depends on the value chosen in another parameter. In this example I will be using the Steel Wheels sample data to create a report which [...]]]></description>
			<content:encoded><![CDATA[<p>Cascade parameters provide a way of managing large amounts of data in reports. You can define a set of related parameters so that the list of  values for one parameter depends on the value chosen in another  parameter.</p>
<p>In this example I will be using the Steel Wheels sample data to create a report which will display a list of customers using two parameters: a drop down parameter which will contain a distinct list of countries which will then filter another drop down parameter which contains cities which belong to the country.</p>
<p><span id="more-878"></span></p>
<h3>The Scenario</h3>
<p>The current report displays customers information (includes the customer number, name, city and country). I would like to create parameters which will enable users to filter the list of customers by a country and then the cities which belong to that country.</p>
<p>Below is a screen shot of my initial report structure and preview screen:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/02/no_param_report_preview.jpg" target="_blank"><img class="alignnone size-medium wp-image-1325" title="Report Preview before Parameters" src="http://www.prashantraju.com/wp-content/uploads/2010/02/no_param_report_preview-300x181.jpg" alt="Report Preview before Parameters" width="300" height="181" /></a></p>
<h3>Step 1. Build the Parameter Queries</h3>
<p>I will need to build two parameter queries, the first will need to display a distinct list of countries and the second will need to display a distinct list of cities which belong to the country.</p>
<p>To get started I will need to add a new query to the data source  which I created to connect to the sample data, from the screen shot below  you can see I already have a query named <span class="inline-pre">customerList</span> which the current report uses to display customer information.</p>
<p>To create a new query click on the <img title="Plus Icon" src="../wp-content/uploads/2010/01/plus_icon.jpg" alt="Add a new query icon" width="15" height="15" /> icon (add a new  query) and enter a SQL statement which will retrieve a distinct list of  countries – make sure you don’t forget to name your query (in this example my country parameter query is named <span class="inline-pre">countryList</span>):</p>
<p><img class="alignnone size-full wp-image-1327" title="countryList Parameter Query Built" src="http://www.prashantraju.com/wp-content/uploads/2010/02/countryList_query_built.jpg" alt="countryList Parameter Query Built" width="371" height="287" /></p>
<p>Here is the above query in a format which you can copy and paste:</p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>
 <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`COUNTRY`</span>
<span style="color: #993333; font-weight: bold;">FROM</span>
 <span style="color: #ff0000;">`customers`</span></pre>
</div>
</div>
<p>The next step is to preview the query – as you can see from the screen shot below the <span class="inline-pre">countryList</span> parameter query is retrieving a distinct list of countries:</p>
<p><img class="alignnone size-full wp-image-1326" title="Distinct list of Countries" src="http://www.prashantraju.com/wp-content/uploads/2010/02/country_preview.jpg" alt="Distinct list of Countries" width="238" height="362" /></p>
<p>Now we will need to add the second parameter which will display a distinct list of cities based on the value of the country parameter. Close the preview window and click on the <img title="Plus Icon" src="../wp-content/uploads/2010/01/plus_icon.jpg" alt="Add a new query icon" width="15" height="15" /> icon (add a new   query) and enter a SQL statement which will retrieve a distinct list of cities – make sure you don’t forget to name your query (in this example my city parameter query is named <span class="inline-pre">cityList</span>):</p>
<p><img class="alignnone size-full wp-image-1328" title="cityList Query Built" src="http://www.prashantraju.com/wp-content/uploads/2010/02/cityList_query_built.jpg" alt="cityList Query Built" width="371" height="287" /></p>
<p>Here is the above query in a format which you can copy and paste:</p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>
 <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`CITY`</span>

<span style="color: #993333; font-weight: bold;">FROM</span>
 <span style="color: #ff0000;">`customers`</span></pre>
</div>
</div>
<p>Preview this query. At the moment the above query is only retrieving a distinct list of every city. I need to make sure that this query retrieves a list of cities based on the country parameter:</p>
<p><img class="alignnone size-full wp-image-1329" title="City Preview" src="http://www.prashantraju.com/wp-content/uploads/2010/02/city_preview.jpg" alt="City Preview" width="237" height="310" /></p>
<p>For this query to only show a list of cities based on the value of the country parameter I will  need to add the country parameter name to the <span class="inline-pre">WHERE</span> clause of the <span class="inline-pre">cityList</span> query. As I have not yet created the country or city parameters I will need to make note of the country parameter name I will be specifying in the <span class="inline-pre">cityList</span> query – I have chosen to call the country parameter <span class="inline-pre">sCountryName</span>. The new <span class="inline-pre">cityList</span> query now looks like this:</p>
<p><img class="alignnone size-full wp-image-1330" title="cityList Query Modified" src="http://www.prashantraju.com/wp-content/uploads/2010/02/cityList_query_built_final.jpg" alt="cityList Query Modified" width="548" height="455" /></p>
<p>Here is the above query in a format which you can copy and paste:</p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>
 <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`CITY`</span>
<span style="color: #993333; font-weight: bold;">FROM</span>
 <span style="color: #ff0000;">`customers`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`COUNTRY`</span> <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>sCountryName<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<p>I have now created both parameter queries – I will need to revisit this area later on to modify the report query <span class="inline-pre">customerList</span> but for now click on the OK button to close the <span class="inline-pre">JDBC Data Source window</span>.</p>
<h3>Step 2. Create the Parameters</h3>
<p>I will need to create two parameters:</p>
<ol>
<li>A country drop down parameter which is named sCountryName (step 1)</li>
<li>A city drop down parameter which will be named sCityName</li>
</ol>
<h4><strong>Creating the sCountryName Parameter</strong></h4>
<p>To create a new parameter make sure you have the <span class="inline-pre">Data</span> tab active, right click on the <span class="inline-pre">Parameters</span> menu item and select the <span class="inline-pre">Add Parameter…</span> option:</p>
<p><img class="alignnone size-full wp-image-1337" title="Add Parameter" src="http://www.prashantraju.com/wp-content/uploads/2010/02/add_parameter.jpg" alt="Add Parameter" width="305" height="175" /></p>
<p>An <span class="inline-pre">Add Parameter…</span> window will pop up. Before you make any changes to the options expand the connection folder on the left and then select the query which will populate the parameter, in this example it is the <span class="inline-pre">countryList</span> query. Below is a screen shot of all the <span class="inline-pre">sCountryName</span> parameter options completed:</p>
<p><img class="alignnone size-full wp-image-1338" title="sCountryName Options" src="http://www.prashantraju.com/wp-content/uploads/2010/02/sCountryName.jpg" alt="sCountryName Options" width="480" height="483" /></p>
<p>The options above are fairly self explanatory however here are descriptions of the most important options:</p>
<ul>
<li><strong>Name</strong>: This is the name we specified in step 1, this <strong>must </strong>match the value of this parameter we put in the <span class="inline-pre">cityList</span> <span class="inline-pre">WHERE</span> clause</li>
<li><strong>Type</strong>: The type of this parameter is a drop down</li>
<li><strong>Query</strong>: The query that will populate this parameter is the countryList query which was created in step 1</li>
<li><strong>Value </strong>and <strong>Display Name</strong>: I have set these both to the COUNTRY field as the value is the same as the output I would like displayed in the drop down parameter</li>
<li><strong>Value Type</strong>: The COUNTRY field is a string</li>
<li><strong>Mandatory</strong>: I have checked this option as a user must select a country before running the report – this also ensures that the city parameter will be populated</li>
</ul>
<p>Click the OK button to save the  <span class="inline-pre">sCountryName</span> parameter.</p>
<h4><strong>Creating the sCityName Parameter</strong></h4>
<p>The second parameter I will need to create is for the city drop down. There isn’t much different from this parameter and the <span class="inline-pre">sCountryName</span> parameter so I can copy and paste this parameter and then change some options.</p>
<p>To copy the parameter right click on the <span class="inline-pre">sCountryName</span> parameter under the <span class="inline-pre">Data</span> tab and select the <span class="inline-pre">Copy</span> option (alternatively you can use the <span class="inline-pre">CTRL+C</span> shortcut):</p>
<p><img class="alignnone size-full wp-image-1341" title="Copy sCountryName Parameter" src="http://www.prashantraju.com/wp-content/uploads/2010/02/copy_sCountryName.jpg" alt="Copy sCountryName Parameter" width="305" height="175" /></p>
<p>To paste the parameter right click on the <span class="inline-pre">Parameters…</span> item and select the <span class="inline-pre">Paste</span> option (alternatively you can use the <span class="inline-pre">CTRL+V</span> shortcut):</p>
<p><img class="alignnone size-full wp-image-1342" title="Paste sCountryName" src="http://www.prashantraju.com/wp-content/uploads/2010/02/paste_sCountryName.jpg" alt="Paste sCountryName" width="305" height="175" /></p>
<p>This will create an identical copy of the <span class="inline-pre">sCountryName</span> parameter.</p>
<p><img class="alignnone size-full wp-image-1344" title="Identical sCountryName" src="http://www.prashantraju.com/wp-content/uploads/2010/02/identical_sCountryName.jpg" alt="Identical sCountryName" width="305" height="175" /></p>
<p>Double click on the <span class="inline-pre">sCountryName</span> parameter which is located at the bottom of the <span class="inline-pre">Parameters</span> list, this will open the <span class="inline-pre">Edit Parameter…</span> window. Before you make any changes to the options expand the connection folder  on the left and then select the query which will populate this parameter,  in this example it is the <span class="inline-pre">cityList</span> query. Below is a screen shot of  all the <span class="inline-pre">sCityName</span> parameter options completed:</p>
<p><img class="alignnone size-full wp-image-1345" title="sCityName Options" src="http://www.prashantraju.com/wp-content/uploads/2010/02/sCityName_options.jpg" alt="sCityName Options" width="480" height="483" /></p>
<p>The options above are fairly self explanatory however here are  descriptions of the most important options:</p>
<ul>
<li><strong>Name: </strong>I have decided to name this parameter <span class="inline-pre">sCityName</span></li>
<li><strong>Type</strong>: The type of this parameter is a drop down</li>
<li><strong>Query</strong>: The query that will populate this parameter is the <span class="inline-pre">cityList</span> query which was created in step 1</li>
<li><strong>Value </strong>and <strong>Display Name</strong>: I have set these both to the <span class="inline-pre">CITY</span> field as the value is the same as  the output I would like displayed in the drop down parameter</li>
<li><strong>Value Type</strong>: The <span class="inline-pre">CITY</span> field is a string</li>
<li><strong>Mandatory</strong>: I have checked this option as a user must select a city before running the report</li>
</ul>
<h3>Step 3. Modify the Report Query</h3>
<p>Now that the parameters and parameter queries have been created we are now ready to modify the report query <span class="inline-pre">(customerList</span>) to use the new parameters. To modify the report query expand the data source connections under the <span class="inline-pre">Data</span> tab and double click on the report query, <span class="inline-pre">customerList</span>:</p>
<p><img class="alignnone size-full wp-image-1348" title="Modify the customerList Query" src="http://www.prashantraju.com/wp-content/uploads/2010/02/customerList_modify.jpg" alt="Modify the customerList Query" width="305" height="175" /></p>
<p>This will open the <span class="inline-pre">JDBC Data Source</span> window and automatically highlight the <span class="inline-pre">customerList</span> query:</p>
<p><img class="alignnone size-full wp-image-1350" title="customerList Query Before Modification" src="http://www.prashantraju.com/wp-content/uploads/2010/02/customerList_ready.jpg" alt="customerList Query Before Modification" width="380" height="289" /></p>
<p>To make the <span class="inline-pre">customerList</span> query use the two new parameters created in step 2 you will need to add in two new conditions to the <span class="inline-pre">WHERE</span> clause:</p>
<p><img class="alignnone size-full wp-image-1351" title="customerList Query After Modification" src="http://www.prashantraju.com/wp-content/uploads/2010/02/customerList_done.jpg" alt="customerList Query After Modification" width="380" height="338" /></p>
<p>Here is the above query in a format which you can copy and paste:</p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`CUSTOMERNUMBER`</span><span style="color: #66cc66;">,</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`CUSTOMERNAME`</span><span style="color: #66cc66;">,</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`CITY`</span><span style="color: #66cc66;">,</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`COUNTRY`</span>

<span style="color: #993333; font-weight: bold;">FROM</span>
 <span style="color: #ff0000;">`customers`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`COUNTRY`</span> <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>sCountryName<span style="color: #66cc66;">}</span>
<span style="color: #993333; font-weight: bold;">AND</span>
 <span style="color: #ff0000;">`customers`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`CITY`</span>    <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>sCityName<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<p>Now the report query will use the values of the <span class="inline-re">sCountryName</span> and <span class="inline-re">sCityName</span> parameters in its <span class="inline-re">WHERE</span> clause. Click on the OK button to close the <span class="inline-re">JDBC Data Source</span> window.</p>
<h3>Step 4. Preview the Report</h3>
<p>The last step is to preview the report, to do this you can click on the <img title="Preview Icon" src="../wp-content/uploads/2010/01/preview_icon.jpg" alt="Preview icon" width="26" height="26" /> (preview icon) found in the top left hand corner or alternatively click on View &gt; Preview menu item.</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/02/preview_report.jpg" target="_blank"><img class="alignnone size-medium wp-image-1352" title="Preview Report" src="http://www.prashantraju.com/wp-content/uploads/2010/02/preview_report-300x181.jpg" alt="Preview Report" width="300" height="181" /></a></p>
<p>By default nothing will be displayed in the report and none of the drop down parameters will be populated (if you would like a country to be set when you first run your report set a value for the <strong>Default Value</strong> option in step 2 for the <span class="inline-pre">sCountryName</span> parameter).</p>
<p>To check if the cascading parameters are working pick a country from the first drop down for example Australia:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/02/pick_australia.jpg"><img class="alignnone size-full wp-image-1353" title="Pick Australia" src="http://www.prashantraju.com/wp-content/uploads/2010/02/pick_australia.jpg" alt="Pick Australia" width="502" height="113" /></a></p>
<p>The city drop down parameter should automatically populate with the cities which belong to Australia <small>(even though I’m not sure if you would classify Glen Waverly as a city)</small>:</p>
<p><img class="alignnone size-full wp-image-1354" title="Cities Drop Down" src="http://www.prashantraju.com/wp-content/uploads/2010/02/cities_dropdown.jpg" alt="Cities Drop Down" width="502" height="172" /></p>
<p>After selecting a city i.e. Melbourne click on the UPDATE button and now the report is filtered to customers who are located in the country Australia and the city Melbourne:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/02/final_report_working.jpg" target="_blank"><img class="alignnone size-medium wp-image-1355" title="Cascading Parameters Working" src="http://www.prashantraju.com/wp-content/uploads/2010/02/final_report_working-300x181.jpg" alt="Cascading Parameters Working" width="300" height="181" /></a></p>
<h3>Downloads</h3>
<p>Below is a link to download the Pentaho Report file for this  tutorial.</p>
<table>
<tbody>
<tr>
<th>Filename</th>
<th>Type</th>
<th>Download</th>
<th>Notes</th>
</tr>
<tr>
<td>CascadeParametersExample.prpt</td>
<td>Pentaho Report</td>
<td><a href="http://docs.google.com/leaf?id=0B9Jmocc0fj_EYzU3Yzc3OGUtZGMzMi00N2E0LThmNDItOGM3YThlM2FiZjZl&amp;hl=en" target="_blank">Download</a></td>
<td>Released 19/02/2010</td>
</tr>
</tbody>
</table>
<h3>Final Notes</h3>
<p>This was tested with PRD 3.5 and <em>should</em> work with PRD 3.6. If you are looking to eliminate the cascading feature you will need to remove the <span class="inline-pre">WHERE</span> clause from the <span class="inline-pre">cityList</span> parameter query:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/02/creating-cascade-parameters-with-pentaho-report-designer-3-5/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Parameter Types with Pentaho Report Designer 3.5.</title>
		<link>http://www.prashantraju.com/2010/01/parameter-types-with-pentaho-report-designer/</link>
		<comments>http://www.prashantraju.com/2010/01/parameter-types-with-pentaho-report-designer/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 12:56:20 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=841</guid>
		<description><![CDATA[Pentaho Report Designer 3.5 came with nine new pre built parameters. Below is a quick overview of the nine parameters. Each overview includes: Screenshot and description How to setup your parameter query How to setup your report query to accept the parameter To directly go to a parameter type you are interested in click on [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Pentaho Report Designer 3.5" href="http://www.pentaho.com/" target="_blank">Pentaho Report Designer 3.5</a> came with nine new pre built parameters. Below is a quick overview of the nine parameters. Each overview includes:</p>
<ul>
<li>Screenshot and description</li>
<li>How to setup your parameter query</li>
<li>How to setup your report query to accept the parameter</li>
</ul>
<p><span id="more-841"></span>To directly go to a parameter type you are interested in click on a link below (every example uses the Steel Wheels sample data):</p>
<ul>
<li><a href="#dropdown">Drop Down</a></li>
<li><a href="#singlevaluelist">Single Value List</a></li>
<li><a href="#multivaluelist">Multi Value List</a></li>
<li><a href="#radiobutton">Radio Button</a></li>
<li><a href="#checkbox">Check Box</a></li>
<li><a href="#singleselectionbutton">Single Selection Button</a></li>
<li><a href="#multiselectionbutton">Multi Selection Button</a></li>
<li><a href="#textbox">Text Box</a></li>
<li><a href="#datepicker">Date Picker</a></li>
</ul>
<h3>Drop Down<a name="dropdown"></a></h3>
<p><img title="Drop Down Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/dropdown_screenshot.jpg" alt="Drop down screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to a select box in HTML</li>
<li>Displays one active option at a time unless you click on the arrow to display all options</li>
<li>Can only select one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines as options inside a drop down.<strong><br />
</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the selected Product Line option from the drop down. <strong>As only one option can be selected at a time it is recommended to use a = (equal) in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<h3>Single Value List<a name="singlevaluelist"></a></h3>
<p><img title="Single Value Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/singlevalue_screenshot.jpg" alt="Single value screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to a list box in HTML</li>
<li>Displays more than one option at once (including the active option)</li>
<li>To see more than one option at once change the Visible Items count under the parameter’s options window</li>
<li>Can only select one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines as options inside a single value list.<strong><br />
</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the selected Product Line option from the single value list. <strong>As only one option can be selected it is recommended to use a = (equal)</strong><strong> in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<h3>Multi Value List<a name="multivaluelist"></a></h3>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/multivalue_screenshot.jpg"><img title="Multi Value Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/multivalue_screenshot.jpg" alt="Multi value screenshot" width="590" height="190" /></a></p>
<ul>
<li>Similar to a multi list box in HTML</li>
<li>Displays more than one option at once (including active options)</li>
<li>To see more than one option at once change the Visible Items count under the parameter’s options window</li>
<li>Can select more than one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines as options inside a multi value list.<strong><br />
</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the selected Product Line options in the multi value list. <strong>As multiple options can be selected at a time make sure you use an IN() condition in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">(</span>$<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span><span style="color: #66cc66;">)</span></pre>
</div>
</div>
<h3>Radio Button<a name="radiobutton"></a></h3>
<p><img title="Radio Button Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/radio_screenshot.jpg" alt="Radio button screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to radio buttons in HTML</li>
<li>Displays more than one option at once (including the active option)</li>
<li>Can only select one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines options as radio buttons.<strong><br />
</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the checked Product Line radio button. <strong>As only one option can be selected at a time it is recommended to use a = (equal)</strong><strong> in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<h3>Check Box<a name="checkbox"></a></h3>
<p><img title="Check box screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/check_screenshot.jpg" alt="Check box screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to a check box in HTML</li>
<li>Displays more than one option at once (including active options)</li>
<li>Can select more than one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines options as check boxes.<strong><br />
</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the checked Product Line check boxes. <strong>As multiple options can be selected at a time make sure you use an IN() condition in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">(</span>$<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span><span style="color: #66cc66;">)</span></pre>
</div>
</div>
<h3>Single Selection Button<a name="singleselectionbutton"></a></h3>
<p><img title="Single Selection Button Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/singlebutton.jpg" alt="Single selection button screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to a buttons in HTML</li>
<li>Displays more than one option at once (including the active option)</li>
<li>Can only select one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines as single selection buttons.<strong><br />
</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the selected Product Line button. <strong>As only one option can be selected at a time it is recommended to use a = (equal) </strong><strong>in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<h3>Multi Selection Button<a name="multiselectionbutton"></a></h3>
<p><img title="Multi Selection Button Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/multibutton_screenshot.jpg" alt="Multi selection button screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to a button in HTML</li>
<li>Displays more more than one option at once (including active options)</li>
<li>Can select more than one option at a time</li>
</ul>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines options as multi selection buttons.<strong> </strong></p>
<p><strong> </strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the selected Product Line buttons. <strong>As multiple options can be selected at a time make sure you use an IN() condition in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">(</span>$<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span><span style="color: #66cc66;">)</span></pre>
</div>
</div>
<h3>Text Box<a name="textbox"></a></h3>
<p><img class="alignnone size-full wp-image-843" title="Textbox Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/textbox_screenshot.jpg" alt="Textbox screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to a text boxes in HTML</li>
<li>Free text only</li>
<li>Is case sensitive and must be exactly the same as the option</li>
</ul>
<p class="notice">I have tried numerous ways on making the text box parameter more flexible, if you have any ideas please let me know.</p>
<p><strong>Parameter Query</strong></p>
<p>This query will display a unique list of Product Lines which the contents of the text box will match.<strong> </strong></p>
<p><strong></strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: enterProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span> <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span> PRODUCTLINE
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span></pre>
</div>
</div>
<p><strong>Report Query</strong></p>
<p>This query will display all information for each product by the contents of the text box matching a Product Line option. <strong>As only one option can be selected at a time make sure you use a = (equal)</strong><strong> in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`products`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`products`</span><span style="color: #66cc66;">.</span>PRODUCTLINE <span style="color: #66cc66;">=</span> $<span style="color: #66cc66;">{</span>enterProductLine<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<h3>Date Picker<a name="datepicker"></a></h3>
<p><img title="Date Picker Screenshot" src="http://www.prashantraju.com/wp-content/uploads/2010/01/date_screenshot.jpg" alt="Date picker screenshot" width="590" height="190" /></p>
<ul>
<li>Similar to standard JavaScript date pickers</li>
<li>No way of formatting the date picker output, for example displays date, time and timezone</li>
</ul>
<p><strong>Parameter Options</strong></p>
<p>As the date picker is providing the user values to input you do not need to specify a parameter query so your parameter options should look similar to the screenshot below:</p>
<p><strong><img title="Date Picker Options" src="http://www.prashantraju.com/wp-content/uploads/2010/01/datepicker_options.jpg" alt="Date picker options" width="272" height="265" /><br />
</strong></p>
<p><strong>Parameter Query</strong></p>
<p>No parameter query is needed as the date picker is generating the parameter value.<strong><br />
</strong></p>
<p><strong>Report Query</strong></p>
<p>This query will display all information for orders which are greater than the specified Order Date from the date pickers value. <strong>As only one option can be selected at a time make sure you use a = (equal)</strong><strong>, &gt;, &gt;=, &lt;= or &lt;</strong><strong> condition in your WHERE clause.</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="sql" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">-- Name: stockByProductLine</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span>   <span style="color: #ff0000;">`orders`</span>
<span style="color: #993333; font-weight: bold;">WHERE</span>  <span style="color: #ff0000;">`orders`</span><span style="color: #66cc66;">.</span>ORDERDATE <span style="color: #66cc66;">&gt;</span> $<span style="color: #66cc66;">{</span>enterOrderDate<span style="color: #66cc66;">}</span></pre>
</div>
</div>
<p>Hopefully these descriptions shed more light on the parameters available in Pentaho Report Designer 3.5.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/01/parameter-types-with-pentaho-report-designer/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Creating Parameters with Pentaho Report Designer.</title>
		<link>http://www.prashantraju.com/2010/01/creating-parameters-with-pentaho-report-designer/</link>
		<comments>http://www.prashantraju.com/2010/01/creating-parameters-with-pentaho-report-designer/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 03:56:00 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=643</guid>
		<description><![CDATA[With the release of Pentaho Report Designer 3.5 users can create parameters through the designer rather than having to build a xaction which at times could be messy and confusing. Here is a tutorial on how you can create a basic parameter with Pentaho Report Designer 3.5. If you aren’t already aware Doug Moran (Pentaho’s [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of <a href="http://www.pentaho.com/">Pentaho Report Designer 3.5</a> users can create parameters through the designer rather than having to build a xaction which at times could be messy and confusing. Here is a tutorial on how you can create a basic parameter with Pentaho Report Designer 3.5.</p>
<p><em>If you aren’t already aware Doug Moran (Pentaho’s Community Leader) has already created a set off <a title="Pentaho Report Designer 3.5" href="http://www.youtube.com/watch?v=qo1BQfgDV-Y" target="_blank">screen casts</a> showing off features of Pentaho Report Designer 3.5.</em></p>
<p><span id="more-643"></span></p>
<h3>The Scenario</h3>
<p>In this tutorial I already have a report which is using the Steel Wheels sample data. My current report displays all customers by the country they are located in and I would like to create a parameter which will filter the results to a user specified country.</p>
<p>Below is a screen shot of my initial report structure and preview screen:</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/customers_by_country.jpg"><img class="alignnone size-medium wp-image-687" title="customers_by_country" src="http://www.prashantraju.com/wp-content/uploads/2010/01/customers_by_country-300x188.jpg" alt="" width="300" height="188" /></a></p>
<h3>Step 1. Build the Parameter Query</h3>
<p>The first step is to build a query which will display a unique<strong> </strong>list of countries. To get started I will need to add another query to the data source which I created to connect to the sample data, from the screenshot below you can see I already have a query named <span class="inline-pre">allCustomers</span> which my current report uses to. To create a new query click on the <img class="alignnone size-full wp-image-688" title="Plus Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/plus_icon.jpg" alt="Add a new query icon" width="15" height="15" /> icon (add a new query) and enter a SQL statement which will retrieve a distinct list of countries also don’t forget to name your query – in this example it is allCustomerCountries:</p>
<p><img class="alignnone size-full wp-image-690" title="Distinct Customer Countries Query" src="http://www.prashantraju.com/wp-content/uploads/2010/01/distinct_cust_count_query.jpg" alt="allCustomerCountries query added" width="542" height="307" /></p>
<p class="notice">Make sure you give meaningful names to your queries as you will always need to reuse them through throughout your report.</p>
<p>Just to be sure preview the report, as you can see from the screen shot below, the <span class="inline-pre">allCustomerCountries</span> query returns a unique list of countries. Close the <span class="inline-pre">Preview</span> window and then click <span class="inline-pre">OK</span> to save your new query and close the Data Sources window.</p>
<p><img class="alignnone size-full wp-image-689" title="Distinct Customer Countries Preview" src="http://www.prashantraju.com/wp-content/uploads/2010/01/distinct_cust_count.jpg" alt="A preview of a unique list of customer countries" width="201" height="286" /></p>
<h3>Step 2. Create the Parameter</h3>
<p>To create a parameter make sure you have the <span class="inline-pre">Data</span> tab active. Right click on the <span class="inline-pre">Parameters</span> menu item and select the <span class="inline-pre">Add Parameter…</span> option.</p>
<p><img class="alignnone size-full wp-image-701" title="Add Parameter Option" src="http://www.prashantraju.com/wp-content/uploads/2010/01/add_parameter_option.jpg" alt="Select the Add Paramter option" width="315" height="189" /></p>
<p>This will display an <span class="inline-pre">Add Parameter…</span> window with a set off options which will need to be filled out (as you can see in the screenshot below I have already filled out the options):</p>
<p><img class="alignnone size-full wp-image-704" title="Add Parameter..." src="http://www.prashantraju.com/wp-content/uploads/2010/01/add_parameter.jpg" alt="Add parameter window filled out" width="435" height="489" /></p>
<p>Here is a description of each option available from the <span class="inline-pre">Add Parameter…</span> window:</p>
<ul>
<li><strong>Name</strong> : The name of your parameter, this will be displayed under the <span class="inline-pre">Parameters</span> menu item – this is important so make sure you give the parameter a meaningful name</li>
<li><strong>Label</strong> : The label which will be displayed to the user, for example “Select a country”</li>
<li><strong>Type</strong> : The type of parameter, for example “Drop Down”</li>
<li><strong>Query</strong> : The query which contains the contents of the parameter, for example <span class="inline-pre">customerCountryList</span></li>
<li><strong>Value</strong> : The actual value of the parameter – this isn’t displayed to the user and is used in the report query, for example Product Number instead of Product Name</li>
<li><strong>Display Name</strong> : The value which will be displayed the the user<strong>, </strong>for example Product Name<strong> </strong></li>
<li><strong>Value Type</strong> :<strong> </strong>The<strong> </strong>data type of the parameter, for example String, Integer, Date etc.</li>
<li><strong>Default Value</strong> : The default value which is to be selected when the report is opened, this should be equivalent to the Value option, for example Australia<strong> </strong></li>
<li><strong>Mandatory</strong> : Check this option if the parameter must be used to display results</li>
</ul>
<p>With the options I have filled out I’m trying to create a report which:</p>
<ul>
<li>Uses a drop down parameter type</li>
<li>Displays the text “Select a country” next to the drop down</li>
<li>By default select Australia as the country in the drop down and in the report results</li>
<li>Make sure that this parameter is always used to display report results</li>
</ul>
<p>Click <span class="inline-pre">OK</span> to save your new parameter.</p>
<h3>Step 3. Modify the Report Query</h3>
<p>Now that we have created our parameter we have to tell the report query to use the parameter’s value in its <span class="inline-pre">WHERE</span> clause. To edit the report query, double click on the query under the <span class="inline-pre">Data</span> tab, in this example the original report query was named <span class="inline-pre">customerCountries</span> and looks like the screen shot seen below:</p>
<p><img class="alignnone size-full wp-image-722" title="Report Query without Parameter" src="http://www.prashantraju.com/wp-content/uploads/2010/01/report_query_without_param.jpg" alt="Report query without parameter" width="511" height="327" /></p>
<p>To make sure the report query will use our new parameter (<span class="inline-pre">enterCountries</span>) add in the following piece of code to the <span class="inline-pre">WHERE</span> clause:</p>
<p><img class="alignnone size-full wp-image-720" title="Report Query with Paramater" src="http://www.prashantraju.com/wp-content/uploads/2010/01/report_query_with_param.jpg" alt="Report query with parameter" width="511" height="364" /></p>
<p>As you can see the we have made the <span class="inline-pre">WHERE</span> clause for the customer country equal to the parameter name <span class="inline-pre">enterCountry</span> which is wrapped between a <span class="inline-pre">${}</span>.</p>
<p class="notice">At all times parameter names must be wrapper between <span class="inline-pre">${}</span></p>
<p>Click <span class="inline-pre">OK</span> to save and close the report query, <span class="inline-pre">customerCountries</span>.</p>
<h3>Step 4. Preview the Report</h3>
<p>The last step is to preview the report, to do this you can click on the <img class="alignnone size-full wp-image-723" title="Preview Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/preview_icon.jpg" alt="Preview icon" width="26" height="26" /> (preview icon) found in the top left hand corner or click on View &gt; Preview menu item.</p>
<p><img class="alignnone size-medium wp-image-724" title="Preview Report" src="http://www.prashantraju.com/wp-content/uploads/2010/01/preview_report-300x197.jpg" alt="Preview report" width="300" height="197" /></p>
<p>As you can see the parameter is set to a default value of Australia and therefore every time the report is run it will be filtered to Asutralia. To test if the report parameter is working I selected a new country Norway and clicked the Update button (if you don’t want to keep clicking Update after you choose a new parameter check the <span class="inline-pre">Autocomplete on selection</span> check box).</p>
<p><img class="alignnone size-medium wp-image-725" title="Test Report" src="http://www.prashantraju.com/wp-content/uploads/2010/01/preview_report_2-300x197.jpg" alt="Test report" width="300" height="197" /></p>
<h3>Step 5. Publish your Report</h3>
<p>The final step is to publish your report to Pentaho Business Intelligence Server (<a title="Publishing content to Pentaho 3.5" href="http://www.prashantraju.com/tutorials/publishing-content-with-pentaho-3-5/" target="_blank">click here to learn how to publish reports</a>) where you will see that the parameter looks exactly the same to when it was previewed in the designer:</p>
<p><img class="alignnone size-medium wp-image-730" title="PUC Report with Parameter" src="http://www.prashantraju.com/wp-content/uploads/2010/01/puc_preview-300x298.jpg" alt="Viewing report with parameter in PUC" width="300" height="298" /></p>
<h3>Downloads</h3>
<p>Below is a link to download the Pentaho Report file for this tutorial.</p>
<table>
<tbody>
<tr>
<th>Filename</th>
<th>Type</th>
<th>Download</th>
<th>Notes</th>
</tr>
<tr>
<td>CustomerCountryParameters.prpt</td>
<td>Pentaho Report</td>
<td><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/CustomerCountriesParameters.zip">Download</a></td>
<td>Released 28/01/2010</td>
</tr>
</tbody>
</table>
<p>That is how you can create a basic parameter driven report using Pentaho Report Designer 3.5.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/01/creating-parameters-with-pentaho-report-designer/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Publishing Content with Pentaho 3.5.</title>
		<link>http://www.prashantraju.com/2010/01/publishing-content-with-pentaho-3-5/</link>
		<comments>http://www.prashantraju.com/2010/01/publishing-content-with-pentaho-3-5/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 01:00:35 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[BI Server]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=480</guid>
		<description><![CDATA[For those starting out with Pentaho it can be confusing on how to publish content (reports, ETL jobs etc.) to Pentaho Business Intelligence (BI) server. I have put together a guide which outlines the steps you will need to enable publishing and also an example of how you can use Pentaho Report Designer (PRD) to [...]]]></description>
			<content:encoded><![CDATA[<p>For those starting out with Pentaho it can be confusing on how to publish content (reports, ETL jobs etc.) to <a title="Pentaho Business Intelligence Server" href="http://www.pentaho.com/" target="_blank">Pentaho Business Intelligence (BI) server</a>. I have put together a guide which outlines the steps you will need to enable publishing and also an example of how you can use <a title="Pentaho Report Designer" href="http://www.pentaho.com/" target="_blank">Pentaho Report Designer</a> (PRD) to publish reports.</p>
<p><span id="more-480"></span></p>
<h3>Modify publisher_config.xml</h3>
<p>To get started you will need to edit the <span class="inline-pre">publisher_config.xml</span> file located under the <span class="inline-pre">/opt/biserver-ce/pentaho-solutions/</span> directory, once open locate the following piece of code:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;publisher-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;publisher-password<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/publisher-password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/publisher-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Enter a password between the <span class="inline-pre">publisher-password</span> tags (this password will be the same for all users) so that the piece of code looks similar to the example below &#8211; in this example the publisher password is <strong><span class="inline-pre">publishthis</span></strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;publisher-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;publisher-password<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>publishthis<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/publisher-password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/publisher-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Save and close this file.</p>
<p>From now on when any users try and publish content to Pentaho BI server they will need to specify this password.</p>
<h3>Login to Pentaho BI server</h3>
<p>In this example I&#8217;m going to publish a report which I created in my <a title="Survey Scale Chart Tutorial Post" href="http://www.prashantraju.com/pentaho/survey-scales-with-pentaho-report-designer-3-5/" target="_blank">survey scale chart tutorial</a> to Pentaho BI server. Within PRD click on <span class="inline-pre">File &gt; Publish</span> (or use the <span class="inline-pre">CTRL+SHIFT+P</span> shortcut) which will display a <span class="inline-pre">Login</span> window:</p>
<p><img class="alignnone size-full wp-image-497" title="Pentaho Report Designer Login Dialog Box" src="http://www.prashantraju.com/wp-content/uploads/2010/01/login_dialog_publishing.jpg" alt="Pentaho Report Desinger Login Dialog Box for Publishing" width="367" height="375" /></p>
<p>You will need to specify user credentials in this window to authenticate with Pentaho BI server, the available fields and options are:</p>
<ul>
<li><strong>URL</strong> : URL of Pentaho BI server (in this example it is hosted locally)</li>
<li><strong>Timeout</strong> : Amount of seconds the connection will last with the server until it times out</li>
<li><strong>Username</strong> : Username of the user publishing to the server (this is the username you use to login to Pentaho User Console (PUC))</li>
<li><strong>Password</strong> : Password of the user publishing to the server (this is the password you use to login to PUC)</li>
</ul>
<p class="notice">The user specified above which is logging into Pentaho BI Server will inherit all access and permissions. Therefore the user will only be able to publish to folders (solutions) which the user has access to.</p>
<p>After filling out the required fields and clicking on <span class="inline-pre">OK</span> a <span class="inline-pre">Login to server</span> progress bar will appear while PRD connects to Pentaho BI Server:</p>
<p><img class="alignnone size-full wp-image-501" title="Login in Server" src="http://www.prashantraju.com/wp-content/uploads/2010/01/login_to_server.jpg" alt="Login into Pentaho BI Server" width="186" height="94" /></p>
<h3>Publish to Pentaho BI server</h3>
<p>After a successful connection a <span class="inline-pre">Publish To Server</span> window will appear:</p>
<p><img class="alignnone size-full wp-image-502" title="Publish to Server" src="http://www.prashantraju.com/wp-content/uploads/2010/01/publish_to_server.jpg" alt="Publish to Server" width="428" height="527" /></p>
<p>Below is an explanation of all available fields and options from the <span class="inline-pre">Publish To Server</span> window:</p>
<ul>
<li><strong>Report Name</strong> : Name of the report being published</li>
<li><strong>Report Description</strong> : Description of the report being published</li>
<li><strong>Location</strong> : The folder (solution) on the server you would like to publish the report to</li>
<li><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/browse_icon.jpg"><img class="alignnone size-full wp-image-538" title="Browse Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/browse_icon.jpg" alt="Browse Icon" width="16" height="16" /></a> : Open the parent folder</li>
<li><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/parent_folder_icon.jpg"><img class="alignnone size-full wp-image-539" title="Parent Folder Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/parent_folder_icon.jpg" alt="Parent Folder Icon" width="16" height="16" /></a> : Opens up a browse window to browse through or create new folders (solutions)</li>
<li><strong>Output Type</strong> : Default output type of the report which users will see in PUC</li>
<li><strong>Lock</strong> : Lock the report format within PUC to the Output Type</li>
<li><strong>Publish Password</strong> : Publisher password (in this example it is <span class="inline-pre">publishthis</span>)</li>
</ul>
<p>For this example I would like to publish my report into a new folder (solution) named <span class="inline-pre">blog</span>. To do this first click on the <a href="http://www.prashantraju.com/wp-content/uploads/2010/01/browse_icon.jpg"><img class="alignnone size-full wp-image-538" title="Browse Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/browse_icon.jpg" alt="Browse Icon" width="16" height="16" /></a> (browse) icon which will open up a <span class="inline-pre">Browse</span> window.</p>
<p><img class="alignnone size-full wp-image-547" title="Browse Window" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Browse.jpg" alt="Browse Window" width="379" height="482" /></p>
<p>Click on the <a href="http://www.prashantraju.com/wp-content/uploads/2010/01/New_Folder_Icon.jpg"><img class="alignnone size-full wp-image-554" title="New Folder Icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/New_Folder_Icon.jpg" alt="New Folder Icon" width="22" height="22" /></a> (new folder) icon which will prompt you to create a new folder:</p>
<p><img class="alignnone size-full wp-image-548" title="Create a New Folder (Solution)" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Create_New_Folder.jpg" alt="Create a New Folder (Solution)" width="482" height="182" /></p>
<p>After entering a <span class="inline-pre">Name</span> and <span class="inline-pre">Description</span> click on <span class="inline-pre">OK</span>. Now the new folder (solution) will appear in the <span class="inline-pre">Browse</span> window along side other folders (solutions):</p>
<p><img class="alignnone size-full wp-image-549" title="Select a folder (solution)" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Select_Report_Location.jpg" alt="Select a folder (solution)" width="379" height="482" /></p>
<p>Click on the folder (solution) (which you would like to publish the report into) to make it active and click <span class="inline-pre">OK</span>. To finish publishing this report complete all necessary fields and options in the <span class="inline-pre">Publish To Server</span> window. In this example we will only need to complete 5 fields:</p>
<p><img class="alignnone size-full wp-image-550" title="Publish to Server" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Publish_To_Server.jpg" alt="Publish to Server" width="428" height="527" /></p>
<ol>
<li><strong>Name</strong> : Name of the report</li>
<li><strong>Description</strong> : Description of the report</li>
<li><strong>Location</strong> : The folder (solution) we are publishing the report to is <span class="inline-pre">/blog</span></li>
<li><strong>Output Type</strong> : I have decided that my report can only be viewed as a PDF</li>
<li><strong>Lock</strong> : I have checked this option to make sure that the report can only be viewed as a PDF and in no other formats</li>
</ol>
<p>Click <span class="inline-pre">OK</span> once your are ready to publish your report. If the report was successfully published you will be shown the following prompt:</p>
<p><img class="alignnone size-full wp-image-560" title="Publish Successful" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Publish_Successful.jpg" alt="Publish Successful" width="469" height="122" /></p>
<p>Click on <span class="inline-pre">YES</span> to run your report straight away.</p>
<h3>Run your report</h3>
<p>After clicking <span class="inline-pre">YES</span> the PUC login screen will be launch in a new window or tab with your default browser. After logging in the report is automatically displayed as a PDF (remember I chose the output type to be a PDF and to be locked):</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/Launch_Report_from_PRD.jpg"><img class="alignnone size-medium wp-image-565" title="Launch Report directly from PRD" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Launch_Report_from_PRD-270x300.jpg" alt="Launch Report directly from PRD" width="270" height="300" /></a></p>
<p>To launch the report within PUC first click on the folder (solution) name in the <span class="inline-pre">Solution Browser</span> which contains the report which was just published &#8211; in this example it is <span class="inline-pre">blog</span>:</p>
<p><img class="alignnone size-full wp-image-566" title="Solution Browser Folder" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Solution_Browser_Folder.jpg" alt="Solution Browser Folder" width="232" height="227" /></p>
<p>After clicking on a folder (solution) all available reports within this folder (solution) will be displayed in the frame below it &#8211; in this example there is only one report <span class="inline-pre">Survey_Scale_Chart_Example</span>, double click on the name of the report which was just published.</p>
<p><img class="alignnone size-full wp-image-568" title="Solution Browser Report Name" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Solution_Browse_Report.jpg" alt="Solution Browser Report Name" width="234" height="107" /></p>
<p>As you can see my report automatically ran as a PDF (remember I chose the output type to be a PDF and to be locked):</p>
<p><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/Launch_Report_from_PUC.jpg"><img class="alignnone size-medium wp-image-570" title="Launch Report from PUC" src="http://www.prashantraju.com/wp-content/uploads/2010/01/Launch_Report_from_PUC-287x300.jpg" alt="Launch Report from PUC" width="287" height="300" /></a></p>
<p>Hopefully these steps can help you in publishing content to Pentaho BI server.</p>
<p class="quiet">This post <em>will</em> be added as a chapter to current Pentaho <a title="Projects - Pentaho" href="http://www.prashantraju.com/projects/pentaho/" target="_blank">documentation</a>.</p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/01/publishing-content-with-pentaho-3-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pentaho Solutions Review.</title>
		<link>http://www.prashantraju.com/2010/01/pentaho-solutions-review/</link>
		<comments>http://www.prashantraju.com/2010/01/pentaho-solutions-review/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 16:10:09 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[BI Server]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=456</guid>
		<description><![CDATA[I was about to do a chapter by chapter review of Roland Bouman and Jos van Dangen&#8216;s masterpiece &#8220;Pentaho Solutions &#8211; Business Intelligence and Data Warehousing with Pentaho and MySQL&#8221; but since I started reading it I haven&#8217;t been able to put it down. It is definitely a must for anyone who is interested or [...]]]></description>
			<content:encoded><![CDATA[<p><img class="left size-full wp-image-467" title="Pentaho Solutions Cover" src="http://www.prashantraju.com/wp-content/uploads/2010/01/pentaho_solutions_cover.jpg" alt="Pentaho Solutions" width="120" height="151" />I was about to do a chapter by chapter review of <a title="Roland Bouman" href="http://rpbouman.blogspot.com/" target="_blank">Roland Bouman</a> and <a title="Jos van Dangen" href="http://www.tholis.com/" target="_blank">Jos van Dangen</a>&#8216;s masterpiece &#8220;<a title="Amazon" href="http://www.amazon.com/Pentaho-Solutions-Business-Intelligence-Warehousing/dp/0470484322/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1263688954&amp;sr=8-1" target="_blank">Pentaho Solutions &#8211; Business Intelligence and Data Warehousing with Pentaho and MySQL</a>&#8221; but since I started reading it I haven&#8217;t been able to put it down. It is definitely a <strong>must</strong> for anyone who is interested or currently working with Pentaho.</p>
<p>Because this book just oozes with awesomeness I have been able to shorten my review to three words &#8220;<strong><a title="Amazon" href="http://www.amazon.com/Pentaho-Solutions-Business-Intelligence-Warehousing/dp/0470484322/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1263688954&amp;sr=8-1" target="_blank">buy it now</a></strong>&#8220;.<strong><a title="Amazon" href="http://www.amazon.com/Pentaho-Solutions-Business-Intelligence-Warehousing/dp/0470484322/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1263688954&amp;sr=8-1" target="_blank"><br />
</a></strong></p>
<p><a title="Amazon" href="http://www.amazon.com/Pentaho-Solutions-Business-Intelligence-Warehousing/dp/0470484322/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1263688954&amp;sr=8-1" target="_blank"> </a>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/01/pentaho-solutions-review/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Survey Scale charts with Pentaho Report Designer.</title>
		<link>http://www.prashantraju.com/2010/01/survey-scales-with-pentaho-report-designer-3-5/</link>
		<comments>http://www.prashantraju.com/2010/01/survey-scales-with-pentaho-report-designer-3-5/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 18:05:58 +0000</pubDate>
		<dc:creator>Prashant Raju</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Pentaho]]></category>
		<category><![CDATA[Report Designer]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.prashantraju.com/?p=257</guid>
		<description><![CDATA[After the new release of Pentaho&#8217;s Report Designer 3.5 (PRD) I thought I would get stuck into trying out some of the new charting features, of which Survey Scales (and of course Sparklines) interested me the most. Survey Scales are a way of graphically representing values on a predefined scale i.e. survey responses. Below is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="left size-full wp-image-282" title="Survey Scale Post Preview" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscale_post_preview.jpg" alt="Survey Scale Post Preview" width="250" height="58" />After the new release of <a title="Pentaho Report Designer" href="http://reporting.pentaho.org/report_designer.php" target="_blank">Pentaho&#8217;s Report Designer 3.5</a> (PRD) I thought I would get stuck into trying out some of the new charting features, of which Survey Scales <span class="quiet">(and of course Sparklines)</span> interested me the most. <strong>Survey Scales are a way of graphically representing values on a predefined scale i.e. survey responses.</strong></p>
<p>Below is a tutorial which I have put together on how to implement Survey Scales within a report using Pentaho&#8217;s Report Designer 3.5.</p>
<p><span id="more-257"></span></p>
<h3>Sample Data</h3>
<p>I have decided to create my own data set for this example which is survey responses from athletes. If you would like you can <a href="../wp-content/uploads/2010/01/SurveyScaleSampleData.xls">download</a> the Excel workbook and import it into your database of choice.</p>
<p>Here is a quick preview of what the sample data looks like:</p>
<table>
<tbody>
<tr>
<th>ID</th>
<th>ATHELETE_NAME</th>
<th>TITLE</th>
<th>DESCRIPTION</th>
<th style="text-align: right;">VALUE</th>
</tr>
<tr>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
<td>&#8230;</td>
<td style="text-align: right;">&#8230;</td>
</tr>
</tbody>
</table>
<p>After importing the data into your database start PRD.</p>
<h3>Create a New Connection</h3>
<p>Once PRD has started create a new connection to the database which contains the sample data. In this example I have called my connection <span class="inline-pre">SurveyResults.</span></p>
<p><img class="alignnone size-full wp-image-380" title="Survey Scales - Create a new connection" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales.jpg" alt="Create a new connection" width="311" height="126" /></p>
<p>Make sure to test the new connection before we start building the query.</p>
<p><img class="size-full wp-image-320 alignnone" title="Survey Scales - Test the new connection" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_2.jpg" alt="Test the new connection to the sample data" width="362" height="240" /></p>
<h3>Build the Query</h3>
<p>You will need to build a query to retrieve the survey results, in this example I have called the query <span class="inline-pre">GetAllSurveyResults</span>.</p>
<p><img class="alignnone size-full wp-image-327" title="Survey Scales - Create a new query" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_3.jpg" alt="Create a new query called GetAllSurveyResults" width="260" height="229" /></p>
<p>Make sure to preview the query before we start building our report.</p>
<p><img class="alignnone size-full wp-image-333" title="Survey Scales - Preview query" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_4.jpg" alt="Preview your GetAllSurveyResults query" width="510" height="180" /></p>
<p>After clicking OK you should now see a <span class="inline-pre">JDBC (SurveyResults)</span> connection, <span class="inline-pre">GetAllSurveyResults</span> query and fields under the <span class="inline-pre">Data</span> tab.</p>
<p><img class="alignnone size-full wp-image-336" title="Survey Scales - New database connection and query created" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_5.jpg" alt="View the new database connection and query under the data tab" width="320" height="228" /></p>
<h3>Report Structure</h3>
<p>Here is how I will be structuring my report:</p>
<ul>
<li><span style="color: #008000;">Page Header</span>
<ul>
<li><span style="color: #3366ff;">Athlete Name (Group)</span>
<ul>
<li><span style="color: #ff6600;">Question Title and Description (Group)</span>
<ul>
<li>Answer (Survey Scale Chart)</li>
</ul>
</li>
<li><span style="color: #ff6600;">End of </span><span style="color: #ff6600;">Question Title and Description</span><span style="color: #ff6600;"> (Group)</span></li>
</ul>
</li>
<li><span style="color: #3366ff;">End of Athlete Name (Group)</span></li>
</ul>
</li>
<li><span style="color: #008000;">Page Footer</span></li>
</ul>
<p>As you can see I&#8217;m creating a report which will group our survey results by Athlete Name and then by Question Titles and Descriptions to which the Athletes provided Answers to.</p>
<h3>Page Header and Footer</h3>
<p>By default I have a template which already has a default <span class="inline-pre">Page Header</span> and <span class="inline-pre">Footer</span> which I have modified for this tutorial.</p>
<p><img class="alignnone size-full wp-image-362" title="Survey Scales - Page Header and Footer" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_18.jpg" alt="Page Header and Footer" width="535" height="111" /></p>
<h3>Creating the Athlete Name group</h3>
<p>After you have created your <span class="inline-pre">Page Header</span> and <span class="inline-pre">Footer </span>the next step is to create the first <span class="inline-pre">Group</span> based on the Athlete Name. Right click on the first <span class="inline-pre">Groups</span> option under the <span class="inline-pre">Structure </span>tab and select the <span class="inline-pre">Edit Group</span> option.</p>
<p><img class="alignnone size-full wp-image-358" title="Survey Scales - Edit Group" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_16.jpg" alt="Click the Edit Group option" width="251" height="66" /></p>
<p>This will open up an <span class="inline-pre">Add Group</span> dialog box, click on the <span class="inline-pre">ATHLETE_NAME</span> field and then the arrow pointing to the right to add it to the <span class="inline-pre">Selected Fields</span> list and click OK.</p>
<p><img class="alignnone size-full wp-image-359" title="Survey Scales - Add Group" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_17.jpg" alt="Edit the groups by adding the ATHLETE_NAME field" width="429" height="283" /></p>
<p>Now you need to add the <span class="inline-pre">ATHLETE_NAME</span> field into the report. Make sure the <span class="inline-pre">Structure</span> tab is active and expand the <span class="inline-pre">Groups</span> option and select the <span class="inline-pre">Group Header</span>.</p>
<p><img class="alignnone size-full wp-image-344" title="Survey Scales - Group Header" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_10.jpg" alt="Click on the Group Header option under the Structure tab" width="206" height="210" /></p>
<p>To make the <span class="inline-pre">Group Header</span> visible on the report canvass click on the <span class="inline-pre">Attributes</span> tab and uncheck the <span class="inline-pre">hide-on-canvass</span> check box.</p>
<p><img class="alignnone size-full wp-image-347" title="Survey Scales - Hide on canvass" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_11.jpg" alt="Uncheck the hide-on-canvass option from the Attributes tab" width="248" height="108" /></p>
<p>Now you should be able to see the <span class="inline-pre">Group Header</span> on the report canvass.</p>
<p><img class="alignnone size-full wp-image-352" title="Group Header Active" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_14.jpg" alt="Group Header in the report canvass active" width="269" height="66" /></p>
<p>At the same time under the <span class="inline-pre">Structure</span> tab, select the <span class="inline-pre">Style</span> tab and scroll down to the <span class="inline-pre">page-behavior</span> section and check the <span class="inline-pre">pagebreak-after</span> option. You have now made the report create a page break after each <span class="inline-pre">ATHLETE_NAME</span> group.</p>
<p><img class="alignnone size-full wp-image-350" title="Survey Scales - Page Break After" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_13.jpg" alt="Check the page-break-after option under the page-behaviour section" width="280" height="140" /></p>
<p>The next step is to drag and drop the <span class="inline-pre">ATHLETE_NAME</span> field from the <span class="inline-pre">Data</span> tab onto the <span class="inline-pre">Group Header</span> section on the report canvass.</p>
<p><img class="alignnone size-full wp-image-392" title="Survey Scales - Group Header" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_28.jpg" alt="Add the ATHELETE_NAME field to the Group Header section" width="330" height="174" /></p>
<h3>Creating the Question Title and Description group</h3>
<p>To create the Question Title and Description group right click on the <span class="inline-pre">Groups</span> section under the <span class="inline-pre">Structure</span> tab and click on the <span class="inline-pre">Add Group</span> option.</p>
<p><img class="alignnone size-full wp-image-364" title="Survey Scales - Add Group" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_19.jpg" alt="Add a group to the Groups option under the Structure tab" width="260" height="90" /></p>
<p>This option will open up an <span class="inline-pre">Add Group</span> window. Click on the <span class="inline-pre">QUESTION_TITLE</span> and <span class="inline-pre">QUESTION_DESCRIPTION</span> fields and then the &gt; button to move these fields to the selected fields list and click <span class="inline-pre">OK</span>.</p>
<p><img class="alignnone size-full wp-image-365" title="Survey Scales - Add Question Title Group" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_20.jpg" alt="Select the QUESTION_TITLE and QUESTION_DESCRIPTION to the selected=" /></p>
<p>After clicking <span class="inline-pre">OK</span> the <span class="inline-pre">Group Header</span>, <span class="inline-pre">Details</span> and <span class="inline-pre">Footer </span>for the Question Title and Description are automatically shown on the report canvass. Drag and drop the <span class="inline-pre">QUESTION_TITLE</span>, <span class="inline-pre">QUESTION_DESC</span> fields from the <span class="inline-pre">Data</span> tab onto the <span class="inline-pre">Group Header</span> section (located under the <span class="inline-pre">Group Header</span> section for the Athlete Names).</p>
<p><img class="alignnone size-full wp-image-368" title="Survey Scales - Question Title and Description Group" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_21.jpg" alt="Drag and drop the Question Title and Description to the Group Header below the Athlete Name" width="400" height="136" /></p>
<p>Now you are ready to add in the Survey Scale chart &#8211; before you continue make sure that your report is grouping correctly by viewing the report in the Print Preview mode.</p>
<h3>Adding in the Survey Scale chart</h3>
<p>For your information here is a quick overview of what elements make up a Survey Scale chart.</p>
<p>On the left are the elements which make up a Survey Scale chart (the labels are options which you can set up to be either a set value or an expression under the <span class="inline-pre">Attributes</span> tab). On the right are the values I have put in for this tutorial, ANSWERS is a field from our <span class="inline-pre">GetAllSurveyResults</span> query. In my data set:</p>
<ul>
<li>The <span class="inline-pre">lowest</span> value can be a 0</li>
<li>The <span class="inline-pre">highest </span>value can be a 10</li>
<li>The <span class="inline-pre">lower-bound</span> value (the lowest answer Athletes should be answering) is 7</li>
<li>The <span class="inline-pre">highest-bound </span>value (the highest answer Athletes should be answering is 10)</li>
</ul>
<p><img class="alignnone size-full wp-image-373" title="Survey Scales - Breakdown" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_23.jpg" alt="Elements/options of a survey scale chart" width="558" height="167" /></p>
<p>You will need to drag and drop the <a href="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_24.jpg"><img class="alignnone size-full wp-image-374" title="Survey Scales - survey-scale icon" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_24.jpg" alt="survey-scale icon" width="21" height="21" /></a> (<span class="inline-pre">survey-scale</span>) chart object onto the <span class="inline-pre">Details</span> section (which sits between the Question Title and Description <span class="inline-pre">Group Header</span> and <span class="inline-pre">Footer</span>).</p>
<p><img class="alignnone size-full wp-image-376" title="Survey Scales - Chart Object" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_25.jpg" alt="After dragging the survey-scale chart object onto the Details section" width="390" height="84" /></p>
<p>Double click on the chart object so that a drop down arrow appears and from the available list select the <span class="inline-pre">ANSWERS</span> value.</p>
<p><img class="alignnone size-full wp-image-377" title="Survey Scales - Select the value" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_26.jpg" alt="Select the ANSWERS field for the value of the survey-scale" width="266" height="184" /></p>
<p>To finish off click on the survey scale chart object then under the <span class="inline-pre">Attributes</span> tab find the <span class="inline-pre">survey-scale</span> section. As you can see I have static values but you can also create dynamic values as an expression.</p>
<p><img class="alignnone size-full wp-image-394" title="Survey Scale - Options" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_29.jpg" alt="Attributes of a survey scale chart object" width="299" height="105" /></p>
<p>To see if you have successfully created a report using Survey Scale charts view the report in the Print Preview mode.</p>
<p><img class="alignnone size-full wp-image-381" title="Survey Scales - Complete" src="http://www.prashantraju.com/wp-content/uploads/2010/01/surveyscales_27.jpg" alt="A preview of a report including Survey Scale charts" width="531" height="533" /></p>
<h3>Downloads</h3>
<p>Below are links to download the Sample Data, Pentaho Report file or view the tutorial report generated as a PDF.</p>
<table>
<tbody>
<tr>
<th>Filename</th>
<th>Type</th>
<th>Download</th>
<th>Notes</th>
</tr>
<tr>
<td>SurveyScaleData.xls</td>
<td>Excel Worksheet</td>
<td><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/SurveyScaleSampleData.xls">Download</a></td>
<td>Released 14/01/2010</td>
</tr>
<tr>
<td>SurveyScaleExample.prpt</td>
<td>Pentaho Report</td>
<td><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/SurveyScaleExample.zip">Download</a></td>
<td>Released 14/01/2010</td>
</tr>
<tr>
<td>SurveyScaleExample.pdf</td>
<td>Adobe Acrobat</td>
<td><a href="http://www.prashantraju.com/wp-content/uploads/2010/01/SurveyScaleExample.pdf">Download</a></td>
<td>Released 14/01/2010</td>
</tr>
</tbody>
</table>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.prashantraju.com/2010/01/survey-scales-with-pentaho-report-designer-3-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

