Multiple PDF export with single JRXML - jasper-reports

I am using iReport for designing the JRXML and JasperReports Server for report scheduling.
I have developed the simple single JRXML in iReport with SQL query that execute query and get the record and generate single pdf.
Now i have different type of records like :
DEPT NAME Salary
---------------------------
HR MR XYZ 500000
MFG MR PQR 300000
HR MR ABC 400000
EDU MR DEF 350000
EDU MR SSS 400000
Now my requirement is to generate individual pdf for each department. Means one pdf contain only HR related data other must contain only EDU related data etc.
How can do it with iReport and JasperReports Server?

You can parametrize your query. If I understand correctly, and choosing department is a matter of simple WHERE clause you can add to the query:
WHERE dept like $P{DEPT_PARAM}
And pass that parameter from jasperserver as needed ("%" for when you need to print for all the departments)

Related

To read dynamic column changes from source table

I am using Talend free version
I have below requirement:
My source is MS ACCESS; table SRC_CUST.
SRC_CUST
CUST_ID CUST_NAME
101 ABC
102 LMN
My target is .csv file TGT_CUST
Requirement: I am using tAccessInput component for MS Access table and I want to load that table into .csv file. My columns are varying day to day on daily basis.
Day 1: SRC_CUST has 2 columns CUST_ID and CUST_NAME so I need to load as it is into .csv file
Day 2: SRC_CUST has 3 columns CUST_ID, CUST_NAME, CUST_ADD so on day 2 I need to load these 3 columns without changing any code, means, I need to achieve column change dynamically .
Note: I am using Talend free version so I neither use any dynamic component nor dynamic data type. I cannot even add columns in "Edit schema" under basic settings of tAccessInput component because my columns are varying.
Please help me for same.
Thanks,
Vaishali Shinde

Jaspersoft studio multiple chart with single query

My database query fetches list of data like:
id key noc date
1 abc 4 1-10-2016
2 abc 12 2-10-2016
3 abc 23 3-10-2016
4 abc 2 4-10-2016
5 def 23 1-10-2016
6 def 44 2-10-2016
7 def 12 3-10-2016
9 def 43 4-10-2016
10 def 43 5-10-2016
abc and def made those no of calls on those dates.
I want to display these data in chart.
But I am fetching this data with a single query, and I want to create 2 charts , one for abc and another for def.
How can I create multiple charts in jaspersoft with single query and making a single chart? As the number of persons making the call can be different , and I will have to create a chart for every person.
When creating or modifying each chart you just need to link them back to the relevant dataset. This can be either the main report dataset or a sub-dataset created just to run the charts.
You only need to follow the instructions on the relevant jaspersoft wiki page and link each new chart back to the required dataset.
Regards,
For getting multiple charts from a single query you need to do :
First create a jasper report, and add a subreport to it. ( Make sure to make the layout growable and the width of the main group should be larger than the subgroup)
Create the dataset
Create Group on right clicking the report from outline panel.
Provide a group name by selecting a column.
Add a expression pointing the column which is grouping the data.
And select reset on group .
Don't forget to set the evaluation time and the evaluation group
For example :
<chart evaluationTime="Group" evaluationGroup="KeywordGroup">

Why do groups appear in different orders on report?

I am currently trying to group data together based on a field "type" using iReports 5.6.0. It seems to work but spreads the groups into different places see example below:
What happens
ID Name Location Type Cost
1 C1 FRA Car 2k
2 C1 FRA Car 2k
3 Transit USA Van 10K
4 Custom USA Van 20K
5 C2 FRA Car 4K
Expected Result:
Example Data
ID Name Location Type Cost
1 C1 FRA Car 2k
2 C1 FRA Car 2k
5 C2 FRA Car 4K
3 Transit USA Van 10K
4 Custom USA Van 20K
I wish the data to come out as the expected result below instead of groups seem to be split up (which I think is it the order data is fed into the report from the application)
I have tried using the keep together option but it doesn't seem to work in this situation.
When using grouping in jasper report to get correct output the data
needs to already be ordered according to the group expressions used.
See: Grouping Data in JasperReports
You can achieve this by either:
order your datasource through query ORDER BY or if using custom datasource for example Collections.sort()
or
use the <sortField/> element in the report for example <sortField name="myField"/>.
In iReport IDE open the Report Query Dialog "edit query" and click the "Sort options..." button (bottom of interface)
In JasperSoft Studio open the dataset and query dialog, find the tab "Order" at the bottom and add your field(s)

IBM Datastage - Join Stage not doing Exact match?

We are using IBM Datastage to match data coming via extracts from various mainframes.
One of the steps is to remove data in Oracle tables that are coming down in the extracts that night and it uses the Join stage to match an extract from an Oracle table against a dataset created from one of the extracts.
The issue is that the Join doesn't seem to do an exact match, it's like it'd using a LIKE using the keys.
Has anyone seen this before?
Example of Data:
Oracle Extract
POLICY_NUMBER SQL Type(VarChar) Extended(Unicode) Length(13)
POLICY_NUMBER CLIENT_NUMBER
A 123456 12345
A 123456W A 123456W01
A 234567 23456
A 234567J A 234567J01
Nightly Extract
POLICY_NUMBER SQL Type(Char) Extended(Unicode) Length(8)
POLICY_NUMBER PRODUCT
A 123456 LIFE
A 234567 PENSION
Dataset after join
POLICY_NUMBER CLIENT_NUMBER
A 123456 12345
A 123456 A 123456W01
A 234567 23456
A 234567 A 234567J01
Adjust the data types - it seems the comparison is done on the char(8). I have not seen it efore - and a test with two differnt char length columns did not match in my test.
There is no like comparison in join.
I think if you adjust the datatypes bioth to varchar(13) it should work.
Otherwise open a PMR.

Jasper Reports Group VS Oracle Order By

I have a report that I am in the process of converting from Crystal Reports to JasperReports. I am designing the report using iReport 4.5 and JasperReport Server 4.5. Oracle Stored Procedure that returns REF_CURSORS is used to populate data. Below is a sample SQL:
Select First_Name, Last_Name, DOB, City From PPL Order By DOB;
When I use this SQL in the report designer and design a report and I create groups as follows
Parent Group is First_Name
Second Group is City
Basically I want to group all the people with similar first name in the all the cities it applies.
Expected results:
First_Name Last_Name DOB City
Alan Kum 10/01/2010 Mumb
Alan Boss 01/10/2001 Mumb
Alan Cross 10/10/2000 Irvn
But since the SQL has an order by clause my data is not displayed in the expected manner as displayed above. How do I overcome this issue?
The issue is I can not change the procedure as it's being used in the application and also an Excel version of the report uses the same query where they want to see the data in order by DOB.
Well... the "correct" solution is to change the query to order by the fields you want to order by: First_Name, City (and then perhaps by DOB or Last_Name to have a fully deterministic ordering).
But since you don't have that option available to you, you can instead do the sorting in JasperReports. Edit your query and then click the button "Sort options...". This should allow you to re-sort the data as you like. It will be slower sorting in the report engine, but slower and correct is far better than a quick result which doesn't meet your needs.