Pages

Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Tuesday, February 17, 2015

Cascading multi select parameters example in pentaho CDE

Hello Guys

You will learn how to do cascading with multi select components in pentaho CDE . There is another post on the same topic in this site which was a basic one.

In this you will find the implementation of 
1) Custom parameters & default values
2) Multi select input controls cascading. 
3) Fixed height & back ground color for  input controls.
    
Final Look of the cascading parameter :

One of the Layouts design for selects (Country select place holder) [Not the Country label  place]

  
Custom Parameters :
param1 for country
Default value in Javascript code  ["US","Canada"]

param2 for state
Default value in Javascript code ["BC","WA"]

param3 for city


select1 for country
    select 1 parameter & listener is : param1


select2 for state
     select2 listeners
     
    select2 parameters (at only parameter place give param2)

select3 for city
    select3 listeners
    

    select3 parameters (at only parameter place give param3)

 Query 1 : country query (SELECT DISTINCT country FROM customer)


Query2 : state query
SELECT DISTINCT state_province FROM customer WHERE country IN (${param1})
NOTE : for multiple selection parameter name should be given with in bracket i.e., with in ()




Query 3 : city query
SELECT
    DISTINCT city FROM customer
WHERE
          (
               country IN (${param1}) 
             AND
             state_province IN(${param2})
          )

NOTE : for multiple selection parameter name should be given with in bracket i.e., with in ()




OUTPUT :  Image 1

Download the example : Click Me - Cascading multi select and HTML tabs examples


:-) Sadakar :-)
Read more »

Saturday, February 14, 2015

Pentaho CDE Webdeatils example Dashboards list Reference



1) Web details site
http://www.webdetails.pt/

2) Example -1 ( BigWire less Example Dashboard)
http://demo.webdetails.org:8080/pentaho/content/pentaho-cdf-dd/Render?solution=ClearWireless&path=&file=maindashboard.wcdf

3) Example-2 (Overview Dashboard)
http://www.webdetails.pt/pentaho/content/pentaho-cdf-dd/Render?solution=Demo&path=%2FDashboards&file=Content01.wcdf

4) Example-3(Grow Mozilla)
https://metrics.mozilla.com/data/content/pentaho-cdf-dd/Render?solution=metrics2&path=%2FgetInvolved&file=getInvolved.wcdf

5) Example-4 (The Fighter Shoot out Dashbard)
http://www.webdetails.pt/pentaho/content/pentaho-cdf-dd/Render?solution=PublicDemo&path=%2FTieDemo&file=TieDemo.wcdf

6) Example-5(SyncDemo1)
http://www.webdetails.pt/pentaho/content/pentaho-cdf-dd/Render?solution=PublicDemo&path=%2FSyncDemo1&file=SyncDemo1.wcdf

7) Example-6(Lekaemia & Lymphoma Research)
http://demo.webdetails.org:8080/pentaho/content/pentaho-cdf-dd/Render?solution=Leukaemia&path=&file=leukaemia.wcdf

8) Example-7 (Leading Product Lines (Pivot Table))
http://www.pentaho.com/pentaho/mantle/home/content/getting_started_launch.html?selectedTab=tab2&selectedContentIndex=0
You need to login to the demo site and then have to check this example
Image found for this example

Why all these examples here ?
You can open this examples in Mozilla browser and debug the css, java script, jquery for your requirements and of course these examples will make your job easy as you have some example ready with you.




Read more »

Friday, February 13, 2015

DateRange Component Example in pentaho CDE

Hi Guys,

A small work out on Date Range component in pentaho CDE.

  • As shown in images create 2 parameters of "Date Parameters" type from Generic section of Components Panel. 
  • lets say one for start date and other for to date.
  • Give default values for both of them.
  • Click on "Date Range input componet" from selects section of Components panel. 
  • These date parameters you have to use in your query and the query dates should be converted to String type before you use.
  • i.e., Sample query written in postgresql(foodmart db of jasperserver) is
SELECT p.brand_name "Brand Name",
    SUM(sf7.store_sales) "Store Sales",
    --SUM(sf7.store_cost) "Store Cost",
    SUM(sf7.unit_sales) "Unit Sales"
FROM sales_fact_1997 sf7
INNER JOIN product p ON sf7.product_id=p.product_id
INNER JOIN time_by_day t ON sf7.time_id=t.time_id
INNER JOIN customer c ON sf7.customer_id=c.customer_id
WHERE
to_char(t.the_date,YYYY-MM-DD) >= ${param1_FromDate}
AND to_char(t.the_date, YYYY-MM-DD) <= ${param2_ToDate}

AND c.country=${param3_Country} AND c.state_province=${param4_State}
GROUP BY p.brand_name
ORDER BY 2 DESC,3 DESC
limit 5





Observations:
My default values for start date and end date are :  2012-01-01 and 2012-01-07

Test 1 : Default values



Test 2 : Today
 

Test 3 : Date Range

In this way you can make use of Date Range Component.

Thank you.





Read more »

Tuesday, February 10, 2015

Export Charts As Images in Pentaho CDE Export PopupComponent Example in Pentaho CDE

Hi Guys,

This post will describe the functionality of "Export PopupComponent" Component in CDE.

We can export the charts either in the form of Data(SQL result set) or as an image.

Export PopupComponent used for doing the above point in CDE as described.

This example developed On : CDE,CDF,CDA,CGG(14.06.18.1-stable)

Layout
1) Row -Column ->ColumnName i.e., htmlObject(ExportOptionColumn).
2) Row -Column->ColumnName i.e., htmlObject(PieChartColumn)

Data sources
Write your query for a pie chart.

Components :
Design and develop pie chart..[Chart component Name : PieChart](Assuming you are already aware of it)

Now, export the above pie chart to image(png or jpg) [jpeg is not supporting yet -just tested] using "ExportPopUpComponent" component.

Core part
Others -->ExportPopUpComponent-->

Name : Export (Appear on the output)
Chart Component to Export : PieChart  [Pie Chart Name]
Data Component to Export : PieChart [Pie Chart result set will be exported]

Chart Export Label : Export Chart
Data Export Label : Export Data
(these two names appear in like tool tip on clicking "Export" )

Chart Export Type: png
Data Export Type : xls

HTML Object : ExportOptionColumn


NOTE : On the dashboard editor , on the working dashboard press shift+G which will pop up CGG window.. check the components for which you want to generate java script in the back end for images..  After checking desired charts to generate graphic in the back end save the dashboard..

See the preview of the dashboard..

Output action images :

Export as Image :


Export Data to xls



Sadakar
BI developer









Read more »

Wednesday, February 4, 2015

Spring 4 MVC Example

By using this tutorial you will easily understand how to develop a Spring 4 MVC example with Maven. I have developed this spring hello world application according to annotation based and step by step process, beginners can easily understand this tutorial. We can also do the same example without maven but you have to download and add required jars manually. Spring is a famous framework using spring we can build complicated applications. Spring mvc is a web part of spring framework build around the principles of spring and it support for Themes, Locales/i18n, Restful services, Annotation based configuration and Seamless integration with other Spring Services/Beans.

Tools used for this application:
  • Spring 4.0.4.RELEASE
  • JDK 1.6
  • Maven 3
  • Jstl
  • Spring Tool Suite (Version: 3.2.0.RELEASE): It is an open source eclipse flavoured IDE like juno, indigo, etc. Spring Tool Suite is also called as STS and it improves your Spring development environment with tips, popup guides, Spring guides and wizards that will make your working experience simpler and quicker.
 Note: Maven will create the necessary directory structure required for your web project. We can also do this example without using maven but in real time projects most of them use maven so i did this example using maven.

Step 1: First you have to Setup Maven Project in Eclipse for that open the eclipse go to File menu and do as shown in below screenshots.




Select the Maven Project and click on the next button then the select project name and location wizard will appears use the default workspace location, click the next and continue as shown in below screenshots.



Enter the below values and click finish.
  • Group Id: com.studywithdemo
  • Artifact Id: Spring4Example
  • Version: 0.0.1-SNAPSHOT
  • Package: com.studywithdemo
Using Maven we need only three dependencies
List of dependencies:
                         Spring-webmvc
                         Servlet-api
                         Jstl

Now double click on the pom.xml file after that select the dependencies and click on the add button and give the values as shown below.


Spring-webmvc:
      Group Id: org.springframework
      Artifact: spring-webmvc
      Version:  4.0.4.RELEASE
Servlet-api:
      Group Id: javax.servlet
      Artifact: jstl
      Version:  1.2
Jstl:
      Group Id: javax.servlet
      Artifact: servlet-api
      Version:  2.5

Now right click on the pom.xml file and select the open with->text editor. It looks like below format.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.studywithdemo</groupId>
  <artifactId>Spring4Example</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Spring4Example Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>4.0.4.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>Spring4Example</finalName>
  </build>
</project>

Spring Configuration Parts


Configuring the web.xml

<?xml version="1.0"encoding="UTF-8"?>
<web-app version="2.5"xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
       <servlet>
             <servlet-name>sampleServlet</servlet-name>
             <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
             <init-param>
                    <param-name>contextConfigLocation</param-name>
                    <param-value>/WEB-INF/config/servlet-config.xml</param-value>
             </init-param>
       </servlet>
      
       <servlet-mapping>
             <servlet-name>sampleServlet</servlet-name>
             <url-pattern>*.html</url-pattern>
       </servlet-mapping>
       
       <display-name>Archetype Created Web Application</display-name>
</web-app>

Configuring the servlet-config.xml

<?xml version="1.0"encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
             http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
             http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
       <mvc:annotation-driven/>
       <context:component-scan base-package="com.studywithdemo.controller"/>
       <!--
       <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
             <property name="prefix" value="/WEB-INF/jsp/"/>
             <property name="suffix" value=".jsp"/>
       </bean>
        -->
        
       <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
       p:prefix="/WEB-INF/jsp/"p:suffix=".jsp" />
</beans>

Creating the Controller

packagecom.studywithdemo.controller;
importorg.springframework.stereotype.Controller;
importorg.springframework.ui.Model;
importorg.springframework.web.bind.annotation.RequestMapping;
@Controller
public class SampleController {
      
       @RequestMapping(value ="/welcome")
       public String sayHello (Model model) {
            
             model.addAttribute("greeting", "Hello, Welcome to StudywithDemo !");
            
             return "hello";
       }
}

Create JSP for View

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE htmlPUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Hello World Example</title>
</head>
<body>
<h1>${greeting}</h1>
</body>
</html>

https://www.youtube.com/watch?v=Rs8r01BH2nU

Finally Run the Application

Type the url: http://localhost:8080/Spring4Example/welcome.html

  

Read more »