Saturday, 24 May 2014

How to install iReport in Linux machine



In this post you will see how to install iReport in Linux machine.

1:- First check out which version of iReport you want to install, to see the iReport versions you can use bellow link.
Now download iReport-5.5.1.tar.gz from bellow link 

2:- After downloading iReport go to the directory where you have downloaded it. In my case it is in Downloads directory.
$ cd /Downloads/
And if you want to copy in other directory you can use mv (move) or cp (copy) command.
$ mv/Downloads/ iReport-5.5.1.tar.gz     /opt/ iReport-5.5.1.tar.gz

3:- Extract iReport-5.5.1 directory from zipped file using bellow command.
 
$ tar -zxvf iReport-5.5.1.tar.gz

Where,
  1. -z : Work on gzip compression automatically when reading archives.
  2. -x : Extract archives.
  3. -v : Produce verbose output i.e. display progress and extracted file list on screen.
  4. -f : Read the archive from the archive to the specified file. In this example, read backups.tar.gz archive.
  5. -t : List the files in the archive.
4:- Now to start iReport open a terminal and type the bellow command.

$ /Downloads/iReport-5.5.1/bin/ireport


Now if your iReport starts that means you have successfully installed iReport.

Thursday, 22 May 2014

Adding ‘All’ in JasperReport input control query and passing 'All' as parameter




In this post you will see how to append ‘All’ keyword in JasperReport input control query and passing 'All' as parameter.

Now the question is where we can use this trick in report, I saw a question in forum where user wanted to append ‘All’ with other input control values so user can also select ‘All’ to select all the values of that input control instead of selecting manually  all the values.

In the case of multiselect parameter of Collection type (java.util.Collection)  you do not need to give "All" to select all the values in iReport as default value for that parameter by default it means all the values are selected.

But if the parameter is single select of String type then the query for input control will be: -

SELECT *
  FROM (SELECT 'All Country' SHIPCOUNTRY FROM orders
        UNION
        SELECT DISTINCT SHIPCOUNTRY FROM orders) b
ORDER BY SHIPCOUNTRY
 
iReport query will be : - 
 
SELECT SHIPCOUNTRY,SHIPCITY
FROM orders
WHERE ($P{p_shipcountry}='All' OR SHIPCOUNTRY=$P{p_shipcountry})
 
Where p_shipcountry is a parameter in iReport and it is single select of String (java.lang.String) type parameter.

Monday, 19 May 2014

Defining a variable in SQL SELECT statement in iReport



In this blog you will see how to define a variable in SQL SELECT statement and use that variable to do the calculations for other computed values.

Defining variables in MySQL or in other database is easy but defining variable in iReport is totally different.
I show you both way how to define variable in MySQL SELECT statement and in iReport.

Defining variable in MySQL: -


SET @tsum := 0;
SELECT SUM(@tsum := @tsum + ProfitTotal) as Cumulative,
       SUM(profit) as ProfitTotal
FROM table_name


Defining a variable in iReport : -

SELECT SUM(@tsum := @tsum + ProfitTotal) as Cumulative
FROM
    (SELECT  profitTotal, @tsum :=0
     FROM table_name ) a

As you can see first I have defined the variable in inner select statement then you can sum up in the outer select statement.

http://stackoverflow.com/questions/23731737/dynamic-variable-value-jasper-report/23742241#23742241

Sunday, 4 May 2014

2. What is Hadoop ?



Apache Hadoop is a framework written in Java for running applications on large cluster built of commodity hardware.
The Hadoop framework transparently provides both reliability and data motion to sapplications. Hadoop implements a computational paradigm named MapReduce, where the application is divided into many small fragments of work, each of which can execute or re-execute on any node in the cluster. In addition, it provides a distributed file system that stores data on the compute nodes, providing very high aggregate bandwidth across the cluster.
All the modules in Hadoop are designed with a fundamental assumption that hardware failures (of individual machines or racks of machines) are common and thus should be automatically handled in software by the framework. Apache Hadoop's MapReduce and HDFS components originally derived respectively from Google's MapReduce and Google File System (GFS) papers.
Hadoop was created by Doug Cutting and Mike Cafarella in 2005. Cutting, who was working at Yahoo at the time, named it after his son's toy elephant. It was originally developed to support distribution for the Nutch search engine project.