Pentaho Tools :

Pentaho C-Tools(CDE,CDF,CDA),Pentaho CE & EE Server,OLAP-Cubes,Analysis using Pivot4J, Saiku Analytics, Saiku Reporting, Ad-hoc Reporting using Interactive Reporting Tool,Dashboards,Reports using PRD, PDD,Data Integration using Kettle ETL,Data Mining usign WEKA,Integration of Servers with Databases,Mobile/iPad compatible Dashboards using Bootstrap Css,Drilldown dashboards,Interactive Dashboards

Monday, 5 May 2014

Embedding BI - Call username & password and dashboard parameters from CDE dashobard URL using iframe tags

A small workout on Embedding BI using Pentaho CDE dashboards..

Version Specific :
BA server : 5.1.0 stable CE
C-Tools : CDE,CDA,CDF of latest TRUNK version (after 14.x)

Steps :
1) Open your dashboard in new window to generate the URL
2) For instance the URL is some thing similar as shown below

URL when you open in new window
http://localhost:8085/pentaho/api/repos/:public:Explore:CDEExploring:Test:passParametersFromURL.wcdf/generatedContent

URL after adding BA Server Username and Password as parameters
http://localhost:8085/pentaho/api/repos/:public:Explore:CDEExploring:Test:passParametersFromURL.wcdf/generatedContent?userid=admin&password=password

URL after adding Dashboard parameters along with BA server credentials as parameters

http://localhost:8085/pentaho/api/repos/:public:Explore:CDEExploring:Test:passParametersFromURL.wcdf/generatedContent?userid=admin&password=password&param1_deptId=100&param2_Date=01/04/2014

Here you need to take custom parameters instead of Simple parameters.
i.e.,
For example :
param1_deptId is the custom parameter and in the java script area you need to write below code
function sendParam(){
   
       return  Dashboards.getQueryParameter("param1_deptId");
   
}


In another case of passing parameter like date type

param2_Date is the custom parameter and in the java script area you need to write below code
function sendParam(){
   
       return  Dashboards.getQueryParameter("param2_Date");
   
}


You need to add these parameters to your chart and query
For chart : 
Parameters : param1_deptId,param2_Date
Listners : param1_deptId,param2_Date
For query :
Parameters: param1_deptId (String Type) 
                     param2_Date(String Type)   

Sample Query in Oracle SQL where clause for the above scenario :
where 
to_char(column1_deptId)=${param1_deptId}
AND
to_char(column2_date(+),'mm/dd/yyyy') =${param2_Date}

note that in the above clause (+) indicates in right outer join Oracle 10g

NOTE: You can pass multiple general parameters by adding &paramName=value in the URL


3) Copy paste the URL in the web browser and test.. You will find the dashboard output directly.

Imp Note : 
URL passing mechanism in BA server 5 is slightly differ from previous versions.
As suggested in jira for pentaho 5 server, you need to modify applicationContext-spring-security.xml under pentaho-solutions/system

Change 1 : at line 22 


Original Code :
/api/**=securityContextHolderAwareRequestFilterForWS,httpSessionPentahoSessionContextIntegrationFilter,httpSessionContextIntegrationFilter,basicProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilterForWS,filterInvocationInterceptorForWS
Replace the Original Code with :

/api/**=securityContextHolderAwareRequestFilterForWS,httpSessionPentahoSessionContextIntegrationFilter,httpSessionContextIntegrationFilter,requestParameterProcessingFilter,basicProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilterForWS,filterInvocationInterceptorForWS

Change 2 : at line 23  
Original Code :

/plugin/**=securityContextHolderAwareRequestFilterForWS,httpSessionPentahoSessionContextIntegrationFilter,httpSessionContextIntegrationFilter,basicProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilterForWS,filterInvocationInterceptorForWS
Replace the Original Code with :

 plugin/**=securityContextHolderAwareRequestFilterForWS,httpSessionPentahoSessionContextIntegrationFilter,httpSessionContextIntegrationFilter,requestParameterProcessingFilter,basicProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilterForWS,filterInvocationInterceptorForWS

Once you done the changes , you need to restart the BA server.

Using iframetags :

<iframe src="DashboardURLwithParameters"></iframe>

References : 
1) http://pedroalves-bi.blogspot.in/2013/08/embedded-analytics-in-pentaho-with.html

2) http://forums.pentaho.com/showthread.php?157329-Authentication-for-CDE-Dashboard

3)http://jira.pentaho.com/browse/BISERVER-10708

4)http://forums.pentaho.com/showthread.php?146325-How-to-link-a-CDE-dashboard-to-another-CDE-dashboard-by-passing-parameters&p=358865#post358865


Thank you for reading this article and if you have any queries and/or suggestions drop your comments....

No comments:

Post a Comment