kunkasurendra Posted August 6, 2007 Share Posted August 6, 2007 Hai all, Subject : Generating Dynamic report based on user selected columnsI am new to JasperReports. I want to generate the Ad Hoc reports using the JasperReports API. For this I am displaying the columns on jsp.From jsp (Front-end) user may select different columns to get the report. If user select 2 columns (UserID, UserName) and select PDF then on PDF file 2 columns will be displayed with data. If user select 4 columns (UserName, UserAddress, UserId, Email) then on pdf/html it will display a report with that columns and sequence of columns also can be changed. 1. How will I send this dynamic columns (database table field name) to Jasper? I want to generate the .JRXML or report file dynamically based on the user selection. Is it possible any way Using JasperReport API. Please help me. Thanks in advance, Surendra Babu. K.Post edited by: kunkasurendra, at: 2007/08/06 10:18 Link to comment Share on other sites More sharing options...
szaharia Posted August 6, 2007 Share Posted August 6, 2007 Hi, Actually, you can prepare your dynamic select in your servlet, according to selected columns, and pass it as parameter to the report, as shown here. hth,sanda Link to comment Share on other sites More sharing options...
kunkasurendra Posted August 6, 2007 Author Share Posted August 6, 2007 Hai, I am not taking about parameters passing to to the where cluase. Ii am talking about ad hoc report generation, for example in my table i have 6 columns, suppose user may select 2 columns,it will create the report with two columns,he may select 3 columns,it will create the report with three columns,like that. please if have any idea on that help me. Link to comment Share on other sites More sharing options...
szaharia Posted August 6, 2007 Share Posted August 6, 2007 Hi, Another idea: let the select unchanged, with all columns included. For each column in the select create a flag. If column was selected, set the related flag to true, otherwise let it be false. Pass all those flags as parameters to the report.For each textfield representing a column, write a printWhenExpression so that the associated flag to be true. Do the same thing for each column header/footer. hth,sanda Link to comment Share on other sites More sharing options...
mmutleab Posted August 14, 2007 Share Posted August 14, 2007 hiwhat do u mean by creating a flagthanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now