Results 1 to 6 of 6
  1. #1
    rajuchacha007 is offline Member
    Join Date
    Mar 2010
    Posts
    16
    Rep Power
    0

    Default Mysql dynamic query, Java and Jasper report

    Actually I have been working on Jasper report. I am using ireport. I have a database in mysql. I am connecting the database to the report in java. Working principle is as follows.

    database connectivity-->java file-->export to .pdf file as front end japer report.

    Earlier I used to design a static structure of the report. (coulmn names,title etc)Now, I wish to do the same within java itself dynamically. I have been thinking that one can't create columns dynamically without designing on ireport. Now, I want to know, whether there is any mechanism to create new columns and corresponding values as parameters(as arguments) while running the java file. This is what I am trying to implement. Let's take an example.

    I have many tables like profile,describtion,schema etc from the database sample. I am selecting name,address, accountNo from these 3 tables respectively. I might be having more tables and correspondning values in the columns. I might select 2 tables and 3 columns or 3 tables 4 columns or many other valid combinations. I want to know, is it possible to achieve such mechanim of dynamic mysql query within jasper report if I have not designed these columns in the .jrxml file. I have many tables. I can not design each and every table on .jrxml file. I believe I am explaning the problem apporpriatly. Pleae do let me know if you know any possible solution.

    e.g.

    select
    name,address,accountNo

    from
    profile,describtion,schema,

    where
    ....
    ....
    ;

    Thank you in advance. I would welcome your suggestions.
    I will edit this post tomorrow and upload whatever I have been trying ASAP.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Cute, you are going to have to drink the schema reference to generate the jrxml files dynamically and then compile them dynamically too. Good luck.

  3. #3
    Join Date
    Apr 2010
    Posts
    1
    Rep Power
    0

    Default

    Try DynamicReports is open source and based on JasperReports.
    You can create reports dynamically without needing to use iReport

  4. #4
    rajuchacha007 is offline Member
    Join Date
    Mar 2010
    Posts
    16
    Rep Power
    0

    Default

    Thank you very much for your replies and informative link.

  5. #5
    omkarkelkar is offline Member
    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Default Same question...

    Hello,
    I have same problem.
    Im generating PDF with jasper report, I can generate rows of table dynamically.
    for that im passing arraylist of class to report.
    but im not able to generate columns dynamically.

    I think topic creater got solution... can you temme??

    waiting for reply.. thank you :)

  6. #6
    rajuchacha007 is offline Member
    Join Date
    Mar 2010
    Posts
    16
    Rep Power
    0

    Default

    @omkarkelkar

    I resolved the issue in other way. I started to use grouping concept. Group expression in ireport/jasper report helped me to define a particular criteria and then I was able to extract the data from existing database. Other choice was to use hashmap to put values and arraylist to do work on columns. I had to finish the task asap so I chose the earlier option of grouping. I didn't migrate to the dynamic change. I am picking up columns from existing data now. sorry for disappointment. Thank you.

Similar Threads

  1. jasper report ,jasper report jar files and maven dependencies.
    By rajuchacha007 in forum Advanced Java
    Replies: 1
    Last Post: 04-09-2010, 08:15 AM
  2. jasper report
    By vidhyaprabu in forum New To Java
    Replies: 6
    Last Post: 11-12-2009, 03:31 AM
  3. Jasper Report
    By sysout in forum New To Java
    Replies: 12
    Last Post: 09-16-2009, 03:37 PM
  4. jasper report in struts
    By saru_2785@rediff.com in forum Advanced Java
    Replies: 2
    Last Post: 03-31-2009, 11:30 AM
  5. JSP and Jasper Report in Netbeans 6.1
    By ShatireAzam in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-08-2008, 09:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •