Using Pentaho Schema Workbench (PSW)

Schema -:
A schema defines a multi-dimensional database. It contains a logical model, consisting of cubes, hierarchies, and members, and a mapping of this model onto a physical model.
The logical model consists of the constructs used to write queries in MDX language: cubes, dimensions, hierarchies, levels, and members.
The physical model is the source of the data which is presented through the logical model. It is typically a star schema, which is a set of tables in a relational database; later, we shall see examples of other kinds of mappings.

Schema files :
Mondrian schemas are represented in an XML file. An example schema, containing almost all of the constructs we discuss here, is supplied as demo/FoodMart.xml in the Mondrian distribution. The dataset to populate this schema is also in the distribution.

The structure of the XML document is as follows:
<schema>
<cubes>
<AggName>
Agg Element
</AggName>
<Dimension>
<Hirerchy>
</hirerchy>
</Dimension>
</cubes>
</schema>

You can see example:
Step-1 Open your Schema Workbench
Step-2 Go to File ->New ->Schema.
Step-3 Click On Schema and set the name of schema like foodmart
Step-4 Right Click On schema and select Add cube
Step-5 click on add cube and set the name of add cube like sales or whatever        you want.
Step-6 Right Click On cube and select a add table  and set the schema like public and name like select database table  means  sales_fact_1997
Step-7 again right click on cube and add  dimension and click dimension
<Dimension type=”StandardDimension” visible=”true” `        foreignKey=”store_id” name=”Dimension Test”>
double click on dimension you can see the hierarchy and set the hierarchy <Hierarchy name=” Hierarchy Test” visible=”true” hasAll=”true”>
Step-8  Inside hierarchy right click on hierarchy and create add table and click table and then provide name and schema name like :<Table name=”store” schema=”public”>
Step-9 In hierarchy you need to set a Level i.e right click on hierarchy and create add level. <Level
name=”Level Test” visible=”true” table=”store” column=”store_country” nameColumn=”store_country” uniqueMembers=”false”>
Step-10 Inside Cube right click on cube and create Add Measure and click Measure and <Measure name=”Measure Creation” column=”customer_id” datatype=”Integer” aggregator=”count” visible=”true”>
Step-11 According to requirement You can create a lots of cube ,procedure is same
Step-12 Now publish the server what you create a Schema ———-
Step-13 click option and click connection set the
connection name =foodmart
select the connection type what you want like select postgresql
Host Name :192.168.2.9
Database Name: foodmart
Port Number:5432
Username :postgres
Password :postgres
Access like : Native (JDBC)
Click Test Button  Connection is done if not come any problem then click ok…
Step-14 Now To publish In server local server type in browser: localhost:7080/pentaho and use username and password what they are provided thats it.
Step-15 Go to Schema Inside File ->click on publish Button set server  url:http://localhost:7080/pentaho/
user:Admin
password:password
Pentaho or JNDI Data source: foodmart click next to public button
Message will shown on screen connection successfully.
Step-16 Now go to type in browser :localhost:7080/pentaho    click file->New-    >JPivot view. Then select schema and cube what you were creating. And click and check all icon you can see all the output type….
Step-17 this is process to create a schema and deployed in local server…….
This code will execute properly——–Schema1.xml
<Schema name=”foodmart”>
<Dimension type=”StandardDimension” visible=”true” highCardinality=”false” name=”Store”>
<Hierarchy visible=”true” hasAll=”true” primaryKey=”store_id”>
<Table name=”store” schema=”public”>
</Table>
<Level name=”Store Country” visible=”true” column=”store_country” type=”String” uniqueMembers=”false” levelType=”Regular” hideMemberIf=”Never”>
</Level>
<Level name=”Store State” visible=”true” column=”store_state” type=”String” uniqueMembers=”false” levelType=”Regular” hideMemberIf=”Never”>
</Level>
<Level name=”Store City” visible=”true” column=”store_city” type=”String” uniqueMembers=”false” levelType=”Regular” hideMemberIf=”Never”>
</Level>
<Level name=”Store Name” visible=”true” column=”store_name” type=”String” uniqueMembers=”false” levelType=”Regular” hideMemberIf=”Never”>
<Property name=”Store Type” column=”store_type” type=”String”>
</Property>
<Property name=”Store Manager” column=”store_manager” type=”String”>
</Property>
<Property name=”Store Sqft” column=”store_sqft” type=”Numeric”>
</Property>
</Level>
</Hierarchy>
</Dimension>
<Cube name=”Sales” visible=”true” cache=”true” enabled=”true”>
<Table name=”sales_fact_1997″ schema=”public”>
</Table>
<DimensionUsage source=”Store” name=”Store” visible=”true” foreignKey=”store_id” highCardinality=”false”>
</DimensionUsage>
<Measure name=”Unit Sales” column=”unit_sales” formatString=”Standard” aggregator=”sum” visible=”true”>
</Measure>
</Cube>
<Cube name=”Warehouse” visible=”true” cache=”true” enabled=”true”>
<Table name=”inventory_fact_1997″ schema=”public”>
</Table>
<DimensionUsage source=”Store” name=”Store” visible=”true” foreignKey=”store_id” highCardinality=”false”>
</DimensionUsage>
<Measure name=”Store Invoice” column=”store_invoice” aggregator=”sum” visible=”true”>
</Measure>
</Cube>
some thing about schema?
=>A schema defines a multiple dimensional database.it consist a logical model,consisting of cubes, hierarchies and member,and mapping on this model onto a physical model

For any questions on Pentaho Schema Workbench, please get in touch with us @ Helical IT Solutions

Best Practices while doing Data Migration

Data migration is one of the most common database related task. In this blog we will talk about the best practices which should be followed while doing any data migration project

 

Data Migration ::

It is a process of moving data from one platform to another platform. This is one of the most common task with databases with setting up of new servers, new databases, new applications, load balancing, HA etc. For a typical data migration project, for ease, any ETL tool can be used (can be open source or proprietary).

data-migration

The different stages of a typical data migration project is highlighted below

 

Step 1: First step is taking data from the source stage (which could be ERP, flat files, any type of database etc) and putting into the database. ER model is generally not changes. At times, additional metadata information, timestamp information can be added.

 

Step 2: Data moved from stage 1 to stage 2 (only those columns are moved which are necessary). Filtering is applied, duplicates are removed, erroneous data is removed. All the logs should be maintained of this step.

Step 3: In this step, we should map the data from old ER model to new ER model. All actions should be logged and metadata should be transferred. Extreme caution should be taken while defining data types just to make sure that no data is rejected because of data length.

Step 4 : All data translations and calculations take place here. Data is translated to meet target system rules, implement functional requirements. Metadata and SID are maintained, all the logs and audit information should also be maintained. Data translation information is maintained in data dictionary.

A check should also be put at this stage to make sure that there is no data duplication happening, no data type error is present etc.

Step 5 : Referential integrity check to be performed to make sure that data structures are completely ready to be written to the target system.

Step 6 : This is the final step. In case if the data is to be shown to outside world in the form of any API, that is created here.

 

Please get in touch with us at [email protected] for any data migration or ETL project.

Nikhilesh

Helical IT Solutions

Best Practices when designing & using iReport /Jaspersoft

This blog talks about the best practices which should be followed when creating reports using iReport or Jasper studio, deploying the same on Jaspersoft server, nomenclature to be used etc.

 

1) Report Margins:

When you develop reports for dashboards, it is advisable to keep all the margins with 0 pixels.

By default margins will be
Left margin         20
Right margin       20
Top margin         20
Bottom margin    20

Change the values to 0

Left margin         0
Right margin       0
Top margin         0
Bottom margin  0

Why?
Because, when set to 0 report panels are well fit when designing the dashboards.

 

2) Bands to keep the components

Do not keep table component, cross tab component in Detail band. Keep all the components either in Title band or in Summary Band as per the requirement. It is advisable to create custom bands to keep the different charts if you need to develop a report with multiple charts.

Why it is not recommended to keep the components in Detail band?

Details band falls into loop till the end of the row/data for fields hence if you keep any other component it will fall in a loop and will give you unexpected behaviour of iReport with bad output.

3) Parameter Naming conventions

It is advisable to give good naming conventions for parameters. For example parameter name could be param_paramName or p_paramName

Eg : 1)  p_startDate 2) p_endDate

Other Naming conventions
The same thing you can apply when you create input controls /Data source Names/Custom band names/Data Set names in iReport & Jasper Repository respectively.

Why ?

Easy to differentiate the variables, parameters and group names etc

4) Remove the other bands which you are not going to use in iReports

5) Variables and Parameter usage in iReport

Make use of internal parameters for the report and for the summation of columns recommended to use the variables.

6) Jasper Project Folder Structure

Project Name

archive (take a back up of jrxmls if you are going to update/modify them in this folder with a version number)

      Resources
     Input Controls ( All your parameter names for the project/various reports)
      Data sources(This folder is useful when you have multiple databases to use in your project)
      Files(Keep all your data source files here, for eg : Excel, CSV, XML and etc)
      JRXML’s (Whatever the JRXMLS you are creating you can keep all of them in this folder)
      Sub Reports(keep all you sub reports in this folder and refer from here where ever you want)
      Images(Keep all your images in this folder- for easy understanding)
      Reports(Keep all your reports in this folder)
      Dashboards(Save all your dashboards here)
      Temp (for temporary files)
      Test (Do experiment at the time of development of report in this folder)

Note that if your project is having lot many reports according to some sections/departments, it is advisable to sub divide the Reports folder with other folders.
For example:
Reports
    A.Department-1
         1.Report Name
         2.Report Name
    B.Department-2
        1.Report Name
         2.Report Name

 NOTE:

When you upload a report to JRXML it is recommended to write the description of the report. By seeing it every one can easily understand the purpose of the report/visualization.

7) Export / Import Utility

Command line utility to import/export/update folders/reports from the jasper server is given below.

Importing
js-import –input-zip(space) <Filename>
Ex: js-import –input-zip(space)”E:Work Space\Unified\Unified Reports\<file name>”

Updating
js-import –input-zip(space)”E:Work Space\Unified\Unified Reports\<file name>” –update

Exporting
js-export <location of the folder in jasper server> –output-zip <location of exporting folder>/<exporting_filename.zip>

8) Bands

Title band:

·         Every report must have some name, give the name of the report in this band.

·         Blue colour back ground with white colour font is preferable to give the titles.

·         Logos of the company are recommended to be placed left side of the band in title band under the title of the report.

Page Header:

·         Page header consists of the page numbers and date type of information. It is recommended to give page header information for long reports with heavy text involved in the reports.

Column Header:

·         This band is used for giving column headers for the fields. You can change the font style, size, give the borders, back ground colours and etc.

Detail band:

·         Detail band is used to display the output of the report using fields fetched by the query.

·         You need to drag and drop required fields to create the report to Detail band format them accordingly.

·         Detail band falls into for loop so we should keep only fields in this band rather than keeping any other component like table , cross tab, chart components.

Column footer:

 ·         This band is used to find the total, max, min of the columns from the details band.

·         You need to create variable for this and drag that variables under the column where you want see the sum, max or min

Page footer:

·         Page footer is used to place the page numbers, confidential type of text for the company etc.

Summary:

·         Summary of the report will be placed in the summary band.

·         Generally we keep the chart component, table component, cross tab component to summarize the report.

9)   9) Why should we keep input controls and data sources in resource folder?

  

Input controls in repository:

Create all your input controls in resource folder because every time for each report you need not to create the same input controls. You just need to link the existing input control from the repository folder.

Data sources in repository:
It is considered as a best practice to create data source connections in a folder called resources  and use this data source for the reports. It’ll reduce the report development time. You need to not create import database connections from iReport once you create this connection in the repository.

For any Jaspersoft, ireport, jasper studio, jasperserver or Open source DWBI requirement, please get in touch : [email protected], www.helicaltech.com

HOW TO CREATE LOCK FILE IN C

 

File locking provides a very simple yet incredibly useful mechanism for coordinating file accesses. Before I begin to lay out the details, let me fill you in on some file locking secrets:-

There are two types of locking mechanisms: mandatory and advisory.

– Mandatory systems will actually prevent read() and write() to file.

– There are two types of (advisory!) locks: read locks and write locks (also referred to as shared locks and exclusive locks, respectively.)

 

Here I am demonstrating READ-LOCK …

In  my  case , I want  to reduce CPU usage which  takes very  high CPU usage % in case of accessing Sqlite3  by  two  application simultaneously.

To solve  this problem  I  applied  lock  file  concept  to synchronizes  applications ,

I applied it for three different applications.

 

Steps followed while creating lock file:-

 

– Finalize  File Name (xyz.lock)

– Finalize  lock file  location

– Before running  application , check lock file is  present or not

if(getlock(lockfile)== 1) :: Lock file is not present

– If lock file is not present  then create  lock file

int lockstatus = setlock(lockfile);

– After  completion  of job  delete lock file

 

Removelock (lockfile)

– If  lock file is  present  then sleep  for  sometime then again check for lock file

– While creating lock file, handle unexpected application closing mechanism to avoid trouble when next time application needs to be run.

 

Note: Extension of lock file is (abc.lock)

Note: Remove lock file when application is forcefully terminating (ctrl + C)

 

(Example of lock file in c using semaphores : –  )

Reference: http://www.c-program-example.com/2012/04/c-program-to-lock-file-using-semaphores.html

D3 Integration with Jaspersoft / iReport / Jasper Server

There can be different methods of integrating a D3 chart inside Jasper like using iFrame, using HTML etc. Below we will try to learn in detail how to do integration of D3 chart using HTML component integration.

 

What is D3 Charting? D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation. So D3 can be used in the HTML component of the Jaspersoft to create different types of visualization like charts, graphs, tables, etc.

 

Few things should be kept in mind:

  1. The HTML component of Jasper soft accepts codes without any delimiters like \n,\r, etc. So the complete HTML code should be converted accordingly. Moreover as the component definition is contained in “<html>………</html>”, all special characters like “, ‘, etc. should be replaced with \”, \’, etc.

2. The output of database query can also be passed to the script in the HTML component making the reports dynamic.

 

3. The html content expression can also access the variables and parameters defined in your report.

Suppose we have a variable name variable1 in iReport which is to be used in the html component. It can be used in the html component as shown below:

“<body><script>var =”+ $V{variable1}+”</script></body>”

 

4. Keep in mind that in the HTML content expression of HTML component you do not need to include the html tag, you only need to add the script, body, head, etc. tag which you are using.

Ex:

<!DOCTYPE html>
<html>
<body style=”background-color:yellow;”>
<h2 style=”background-color:red;”>This is a heading</h2>
</body>
</html>

 

In HTML component expression of iReport it would be written in the below format.

“<body style=\”background-color:yellow;\”><h2 style=\”background-color:red;\”>This is a heading</h2></body>”

 

5. Check whether sql jar (the database server you are using for your application) file is available with Jasper soft or not. By default it is not available. Download the jar file from internet and import the jar file in your application by going to the Tool ->Option. In the option menu, go to the classpath tab and click on add jar. Give the location of the jar file you downloaded.

 

Also make sure that the html component jar file is also present in the iReport<version>/iReport/modules/ext with name of jasperreports-htmlcomponent-<version>. If it is not present then download it and paste it in the same folder. (By default it is present. But check it.)

Jaspersoft chord D3 integration

Jaspersoft chord D3 integration 3

Jaspersoft force D3 integration 2

Jaspersoft chord D3 integration 2

How to untar / Extract a TAR file using Java

Hi,

we will explain how to extract the contents of a TAR file through a Java . In order to decompress TAR file, we will be using Apache Commons Compress library, so make sure you have a copy of this library commons-compress-1.4.1.jar loaded into your classpath. You will also require Apache Commons IO library commons-io-2.4.jar in your classpath as we will use this to write every single extracted file from the TAR archive to disk.

1)You use TarArchiveInputStream to read a TAR file as an InputStream. Once you get a TAR file as an object of this type, you can easily start processing on the file.

————————

import java.io.*;
import org.apache.commons.compress.utils.*;
import java.util.zip.*;
import org.apache.commons.compress.archivers.tar.*;
import org.apache.commons.compress.archivers.*;
import org.apache.commons.compress.compressors.gzip.*;
import java.util.*;

————————–

File tarFile = new File(c:/test.tar);
File dest = new File(c:/temp/);

TarArchiveInputStream tarIn = new TarArchiveInputStream(
new GzipCompressorInputStream(
new BufferedInputStream(
new FileInputStream(
tarFile
)
)
)
);

TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
// tarIn is a TarArchiveInputStream
while (tarEntry != null) {
// create a file with the same name as the tarEntry
File destPath = new File(dest, tarEntry.getName());
System.out.println(“working: ” + destPath.getCanonicalPath());
if (tarEntry.isDirectory()) {
destPath.mkdirs();
} else {
destPath.createNewFile();
byte [] btoRead = new byte[2048];
BufferedOutputStream bout =
new BufferedOutputStream(new FileOutputStream(destPath));
int len;
while((len = tarIn.read(btoRead)) != -1)
{
bout.write(btoRead,0,len);
}

bout.close();
btoRead = null;

}
tarEntry = tarIn.getNextTarEntry();
}
tarIn.close();

——————————————–

Finally , you close all output streams / files opened and that completes the program.

Thanks & Regards,

Vishwanth S

Senior ETL Developer.

 

Creating Candlestick Chart in iReport / Jaspersoft / Jasper Report

This blog will talk about how to create candlestick chart in Jaspersoft.

PREREQUISITE S/W:-

  • Jaspersoft(any version)
  • iReport tool(design)
  • d/b softwares (eg.MySql)
  • JAVA
  • Eclipse(if require)

 

WHAT IS CANDLE STICK CHART?

The candlestick techniques we use today originated in the style of technical charting used by the Japanese for over 100 years before the West developed the bar and point-and-figure analysis systems. In the 1700s, a Japanese man named Homma, a trader in the futures market, discovered that, although there was a link between price and the supply and demand of rice, the markets were strongly influenced by the emotions of traders.

 

HOW TO READ CANDLESTICK CHART?

In order to create a candlestick chart, you must have a data set that contains open, high, low and close values for each time period you want to display. The hollow or filled portion of the candlestick is called “the body” (also referred to as “the real body”). The long thin lines above and below the body represent the high/low range and are called “shadows” (also referred to as “wicks” and “tails”). The high is marked by the top of the upper shadow and the low by the bottom of the lower shadow.

Candlestick chart Jaspersoft iReport

 

FORMATION:

STEPS:-
1.      Create report in i-report designer,  select Blank A4 size report from ireport designer.
Ex:
File > New > Blank A4
(here eg.DemoOfCandlestickchart->NEXT->FINISH)

2.    Delete all band except summary band

3.    Goto-> Palette window tool->Select chart->Select MultiAxis chart->Select TimeSeries chart->Ok

4.    Right Click on Multiaxis chart->Select Add Exist Chart->Select Candlestick chart->Ok
(add two candlestick chart into multiaxis chart)

While writing query  keep in mind following things:
•    For input values to Candlestick chart  we require 5  values for each chart
High value

Low value
Open value
Close value
Volume value

 

Example:-

 

select

avg(0) as  avg,

MAX(0) as max,

MIN(0) as min,

STDDEV(0) as std_dev,

“dummy” as _lable,

 1-1-1111   as _date,

as  abc  from dual

 

· Add  new Dataset ->Write query->add it

· Goto -> Report Inspector->Summary band-> Select candlestick chart (first)

->Right click on it ->Select chart data->goto chart data

Note:-  Generally creating single candlestick chart  first candlestick High-close value  are same and second chart Low-close value are same

Candlestick chart Jaspersoft iReport 2

 

5. Similarly as mentioned above instruction  set data for another chart .
Eg:

Candlestick chart Jaspersoft iReport 3

INSTALLING JASPERSERVER IN AWS EC2 / LINUX

Things we need to find out before installing Jasperserver in AWS EC2 / Linux.

1)      Identifying whether your CPU is a 64bit or not. Use below command to find it

uname –m

Our CPU is a 64 bit.

 

2)      Identify whether Jasperserver default port 8080 is open or not? Below command helps you to identify it.

netstat -an | grep 8080| grep LISTEN

 

If nothing has not returned, then your port 8080 is free to use.

Installing Jasperserver

3)      Created a folder Helical and Jasperserver under home.

/home/Helical/Jasperserver.

 

4)      Downloaded Jasperserver 30-days trial from here http://www.jaspersoft.com/thanks-download-30-day

File name: Jasperreports-server-5.5-linux-x64-installer.run

 

Command used to download:

wget https://s3.amazonaws.com/jaspersoft_downloads/5.5/jasperreports-server-5.5-linux-x64-installer.run

 

If you face an Error saying “ -bash: wget: command not found.” Then it means wget package is not installed. Installed wget package using

 

yum install wget

 

Repeat wget command again.

 

5)      Downloaded “jasperreports-server-5.5-linux-x64-installer.run” under the location “/home/Helical/Jasperserver”.

 

Apply chmod 777 for the downloaded file

It was confirmed that port 8080 is not in use with any other process. Thus i am going forward with Jasperserver installation as

“./ jasperreports-server-5.5-linux-x64-installer.run”

Results of each step:

A)     Welcome to the JasperReports Server 5.5 Setup Wizard and its License Agreement. Do as it says and finals asks you to accept the license or not.

Press [Enter] to continue :

Reading the agreement

Accepting the License (y/n): Y

B)      It asks you to select the option of installation (Install All or Custom). If it is for the first time Installation select first option.

Please choose an install option below:

[1] Install All Components and Samples  (requires disk space of: 1.3 GB)

[2] Custom Install

Please choose an option [1] : 1

Jasper installation AWS 3

C)     It asks you to select a folder to install. By default it takes “/opt/jasperreports-server-5.5”

Jasper installation AWS 2

Press Enter simple Instead saying Yes(Y).

D)     It asks you to confirm the Installation by Continuing. Say (Y)

Do you want to continue? [Y/n]: Y

Jasper installation AWS

Start Your Jasperserver from the place you have installed it. Here the Jasperserver installed path is “/home/Helical/Jasperserver/y”.

Starting Jasperserver:

You can start the jasperserver in any one of the way sh ctlscript.sh start (or)  ./ ctlscript.sh start

Check the Status of the Service:

sh ctlscript.sh status

Once again the check the port number 8080 is engaged or not.

By default jasperserver uses Postgres Database thus from this installation even postgres DB will also be available on Port Number 5432 in your machine. No need to install it explicitly.

Location of Postgres: “/home/Helical/Jasperserver/y/postgresql/bin”

Now you must be able to access the Jasperserver from “ipaddress:8080/jasperserver-pro”. If not able to access it Check whether 8080 is configured to access TCP/IP incoming and outgoing in iptables.

Edit iptables as root user using vi /etc/sysconfig/iptables

 

Add a rule saying

 

-A INPUT -p tcp -m state –state NEW -m tcp –dport 8080 -j ACCEPT

 

Now you must be able to access the Jasperserver.

Creating Jasper Reports In (iReport) Using XML As Data Source & Publishing It to Jasper Server

This blog will teach how to create Jasper Reports using iReport, the data source to be used is XML and then publish it on Jasper servcer

  1. Run iReport; it will open showing a Welcome Window, as shown in the following screenshot:

Jasperreport XML data source

2.  DataBase (DataSource ) Connection :

a.)  Click On Datasource button

Jasperreport XML data source 2

b) Click On new button

Jasperreport XML data source 3

C) Select XML datasource

Jasperreport XML data source 4

d) A new window named XML file datasource will open, as in the following

Jasperreport XML data source 5

e) Enter AddressBook (you can give the name of your choice also) as the name for your new connection for the XML datasource in the text box beside the Name text field  & Click the Browse button to browse to the addressbook.xml file located in the E:/ in my system. Select the Use the report XPath expression when filling the report option in the XML file datasource window,

Jasperreport XML data source 5

f) Now click on “TEST” for testing the connection

3. Creating The Report  :  Open a new report and then go to “query browser”,choose the query language from drop down list as “xpath.” The text area below the Query language drop-down list will split into two parts. The left part  shows the actual XPath expression, whereas the   right part shows XML nodes

Jasperreport XML data source 7

4. In the XML nodes right click on the name child of the person node,select “add node as field”,similarly for phone child of person node also.

Jasperreport XML data source 8

5. Double-click on the Fields node in the Report Inspector window on the left of your report. The Fields node will expand to show the fields name, phone.

Jasperreport XML data source Query

Drag-and-drop the name and phone field from the Fields node into the Detail section of your report.

6. Switch to the Preview tab and you will see your report The result should be similar to the below

Jasperreport XML data source 10

7. Publishing the report to the jasper server

a) Creating data adapter :

a.)    Creating Data Adapter :  To use flat files as a datasource (like  XML  files) you need to use DataAdapters in Jasperserver instead of regular datasources. We can create them manually in the server (it’s just an XML file). Data Adapter is a way to define a source for Jasper Reports using a   configuration file,(act as the bridge between data source and jasper reports while publishing the jasper report on Jasper Server).

xmlAdapter.xml

Jasperreport XML data source 11

<filename>repo:/reports/interactive/xmlData</filename>  – > here xmlData is the name of the xml    file(addressbook.xml) which we have to add again to the Jasper Server.(I have added this file in this location “repo:/reports/interactive/”.

b) We need to add XML datasource to server also

c) Adding xmlAdapter To The Properties attribute of Report.

Property Name : net.sf.jasperreports.data.adapter

Property Value : repo:/reports/interactive/xmlAdapter

 

Note: By default xpath or xpath2 language will not come in jasper server,for this you need to do three things…

  1. Copy jasperreports-extensions-3.5.3.jar from /ireport/modules/ext to JasperReports Server/jasperserver-pro/WEB-INF/lib/jasperreports-extensions-3.5.3.jar
  2. Add the following line to /jasperserver-pro/WEB-INF/classes/jasperreports.properties

net.sf.jasperreports.query.executer.factory.xpath2=com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory

  1. Restart Tomcat

Best practices to be followed while developing jasper report using ireport / jasper studio

Software used:  i-report / jasper studio, jasperserver

A)First before creating report keep in mind following things:

  1. Set page (report) properties

Eg:-Page height,width,left-right margin, orientation

 

2.Set Same properties for palette elements  like text,static

Eg:-Font style,size,horizontal –vertical alignment,

Position type, stretch type.

 

B)check  jasperserver version comp ability, between where you are developing and where you would be deploying.  

Steps:-In  i-report  tool

Goto – tool menu->Options->ireport>General>compability->select version

C) While report uploading on to jasperserver repository

1. Check input control and datasource.

2. Usually make one folder on jasperserver  as resources. In that create your input control as well as datasource

3. For adding subreport onto server make subreportJRXML

 

D) For importing and exporting  report from jasperserver

1.JasperReports server should be stopped when using the import and export utilities. This is very important for the import utility to avoid issues with caches, configuration, and security.

2.All command line options start with two dashes (–).

3. You must specify either a directory or a zip file to export to or import from.

4. Make sure the output location specified for an export is writable to the user running the command.

 

Use the command : Export and Import Utility in Jasper Report Server

Before Importing,  go into buildomatic directory of jasper Location: C:\Program Files\jasperreports-server-5.0\buildomatic

 

For importing JS data :-

Windows: js-import –input-zip(space) <Filename>
Ex: js-import –input-zip(space)”E:Work Space\Unified\Unified Reports\<file name>”

 

Update Command

js-import –input-zip(space)”E:Work Space\Unified\Unified Reports\<file name>” –update

 

For Exporting Jasper Reports:

Exporting project folder from jasper community server

 

1)  Goto PuTTY

Give username and password

 

2) Go to the location of jasperserver cp 5.0.0(or any version)

Example:

[email protected]:cd /opt/jasperreports-server-cp-5.0.0

 

3) Navigate to buildomatic folder

Example:

[email protected]:cd /opt/jasperreports-server-cp-5.0.0/cd buildomatic

 

4) Execute js-export.sh file with the destination path.

 

Syntax :

[email protected]:cd /opt/jasperreports-server-cp-5.0.0/buildomatic#./js-export <location of the folder in jasper server> –output-zip <location of exporting folder>/<exporting_filename.zip>