Saturday, February 14, 2015

Cascading parameters example in Pentaho CDE

Hi Guys,

It is quite easy to learn about cascading parameters in pentaho CDE dash boarding.

Example below teach you how to give cascading parameters on CDE dashboard.

Environment :
C-Tools 13.09
Pentaho BA Server 4.8 stableb
DB : postgreSQL foodmart ( jasperservers database)

IDEA of cascading parameters:
  Example:
1) Lay out section
* Design your lay out for keeping the parameters on dasbharod.
* Sample reference design of layout.

2) Components section
* You need to define 3 selects for 3 parameters 
* You need to define 3 parameters
* Observer the Sample worked out image below
*


* Define 2 parameters for country and state(paramCountry and paramState)
* Define 3 Selects for displaying  the selection of parameters on dashboard.
( CountrySelectComponent, StateSelectComponent, CitySelectComponent)

Parameters
1. ParamCountry

i.e, Name= paramCountry and Propertyvalue=USA(default value)
2. paramState
     Name=paramState and Propertyvalue=OR(default value)
NOTE : you need NOT to create parameter for city in this case.

Select Components
* Select components are used to display the data coming from sequel query on dashboard as drop down list at the respected place holders.

1) CountrySelectComponent




Name: CountrySelecte Component
Parameter: paramCouentry (you should give param name otherwise, it wont work)
Datasource: give the query name (will discussion in Datasource selection)
HtmlObject : countrySelect

2)StateSelectComponent


Name: StateSelectComponent
Parameter : paramState
Listners : paramCountry
Parameters : Arg(paramCountry) and val(paramCountryP)
Datasource : queryState
HtmlObject : stateSelect

3) CitySelectComponent
* You need add two listners and two parameters at Listerns and parameters properties
Name;CitySelectComponent
Parameter : No need to give any parameters name here as we are not using parameter for city sleelct
Listners : paramState,paramCountry
Parameters :
 Arg(paramCountry) and val(paramCountry)
Arg(paramState) and val(paramState)
Datasource : queryCity
HtmlObject : citySelect


3) Data Sources section:

 Write queries for 3 selects

1) queryCountry(above image)

Name: queryCountry
Driver: org.postgresql.Driver
User name : postgres
Password : postgres
URL : jdbc:postgresql://localhost:6062/foodmart (5432 is the default port number for postgreSQL)
Query: SELECT DISTINCT country from customer
Parameters : paramCountry(arg) and paramCountry(val)

2) queryState(image is not shown in post refere queryCountry image)

Name: queryState
Driver: org.postgresql.Driver
User name : postgres
Password : postgres
URL : jdbc:postgresql://localhost:6062/foodmart (5432 is the default port number for postgreSQL)
Query: SELECT DISTINCT state_province from customer where country=${paramCountry}
Parameters : paramCountry(arg) and paramCountry(val)

3) queryCity(image is not shown in post refere queryCountry image)

Name: queryCity
Driver: org.postgresql.Driver
User name : postgres
Password : postgres
URL : jdbc:postgresql://localhost:6062/foodmart (5432 is the default port number for postgreSQL)
Query: SELECT DISTINCT city from customer WHERE country=${paramCountry} AND state_province=${paramState}
Parameters : paramCountry(arg) and paramCountry(val)
                     paramState(arg) and paramState(val)


Save the dashboard  and see the preview.

Final output:
1) Test 1

2) Test2

Thank you for reading this post :) :)

for queries and suggestions : sadakar.1988@gmail.com

SOURCE CODE OF THIS EXAMPLE:

https://drive.google.com/file/d/0BymV_QP4TGBEZGhpb1hySDBoSEE/edit?usp=sharing 


:-)





No comments:

Post a Comment

Note: Only a member of this blog may post a comment.