Jump to content
Changes to the Jaspersoft community edition download ×

How Report of this Type is Designed


kogantivijay

Recommended Posts

HI all,

Please find Below the Two tables that has data and how i want to fetch my Report from this to be Viewed ..I am newbie to jasper Was unable to figure out how this can be done ..Can some one help me or Guide me in Right Directtion...

Table: Info

id empid location phonenuber

1 9 India 999999

 

Table :Projects

 

id empid projectId projectDesc

1 9 1 MyFirst(1st)Project

2 9 2 MySecond(2nd)Project

3 9 3 My3rdProject

4 9 4 My4thProject

 

My Report should be like this.::

*********************************************

EMPLOYEE INFO

*********************************************

Emp Id : 9

Location :India

PhoneNumber :999999

******************************************

PROJECTS

*********************************************

#########

PROJECT:1

#########

 

ProjectId : 1

EMp Id : 9

ProjectDesc :MyFirst(1st)Project

 

#########

PROJECT:2

#########

 

ProjectId : 2

EMp Id : 9

ProjectDesc :MySecond(2nd)Project

 

#########

PROJECT:3

#########

 

ProjectId : 3

EMp Id : 9

ProjectDesc :My3rdProject

 

#########

PROJECT:4

#########

 

ProjectId : 4

EMp Id : 9

ProjectDesc :My4thProject

Post edited by: kogantivijay, at: 2007/05/11 14:44

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

I am not very experienced with reports too but I think that I can give you an idea how to make this report.

You can put "*" and "#" in static fields.

The details on every specific project you can put in subreport(I suppose you have collection of project's details).I mean this section:

 

#########

PROJECT:1

#########

 

ProjectId : 1

EMp Id : 9

ProjectDesc :MyFirst(1st)Project

 

...

I think you might already know but just in case ;) - there is really good tool that you can use to create your jrxml - iReport.

Link to comment
Share on other sites

Hi ,

 

Actually my problem was not to display the '#' or '*' It is mainly to do with the getting the Data from Two tables which is having a cardinality of -> 1:n that is 1Employee is having multiple projects and when i query the DB with Employee in the where class i end up getting as many rows as the number of projects and since i pass the Result set to the jasper report I end up printing the Details from the Table 1 every time i am printing my project..

 

Thanks,

vijay

Link to comment
Share on other sites

Use the same query(group by emp id)as you told and divide that in your report...like this

 

1. Divide the report into main and subreport(ie use 2 reports)

2. Display the employee info in the main report(make sure that you do not print repeated values)

3. Display the projects by calling the subreport from the main report (using the subreport parameter)

 

This will give you the report what you are trying to get.

 

Regards,

Arun.v

Link to comment
Share on other sites

Hi Arun,

 

I tried with the sample using Ireport by Creating a Query using the ireport but i can not figure out how I can implement it as i need to pass a empId which will be only determined at runtime so i have the option only to pass a Result set..Here is my Piece of Code where i call the jasper by passing parameters...Could not figure out how i can implement the Subreport Here but was sure that this would solve my Purpose as i was able to see it in the sample..

 

String selectstmt = "select A.EMP_ID,A.EMP_NAME,A.DOB,C.EMP_ID, "

+ "C.PROJECT_ID,C.CLIENT_NAME,C.ROLE_PROJECT "

+ " from personal_info A,it_projects C where A.EMP_ID = C.EMP_ID ";

 

 

rset = stmt.executeQuery(selectstmt);

 

JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(rset);

JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, paramsMap,resultSetDataSource);

 

Please help me out ..

Thanks,

vijay kumar k

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...