Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:19:30+00:00 2026-06-04T21:19:30+00:00

I am generating a Jasper Report, which has 5 fixed columns. The client has

  • 0

I am generating a Jasper Report, which has 5 fixed columns. The client has requested the ability to select the number of columns at run time.

For example if he checks 2 columns from a displayed JTable then there should be 2 columns in Jasper report, if he checks 4 then there should be four columns in jasper report. To try to solve this I am thinking of adding condition in jasper report. If the client selects column A and B I will set that as a parameter in the report and use that to determine whether to display the column.

In order to do these, I need to use conditions in the Jasper XML. Where should I set the conditions in the report.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:19:34+00:00Added an answer on June 4, 2026 at 9:19 pm

    You can try the following

    1. Create a HashMap and set the required properties in it

      Map params = new HashMap();
      params.put("DISPLAY_COLUMN_ONE", "Y")
      
    2. Pass this params map to Jasper in the method

      JasperFillManager.fillReport

    3. In your JRXML, create a parameter corresponding to each property set
      in the hashmap above:

      <parameter name="DISPLAY_COLUMN_ONE" class="java.lang.String"/>

    4. Display the columns based on the parameter value

      <printWhenExpression><![CDATA[$P{DISPLAY_COLUMN_ONE}.equals("Y")]]></printWhenExpression>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a example for dynamic jasper report. I am using NetBeans IDE. I
We are getting the following error while generating a Jasper report when running our
I am generating a report with that will have a 7 columns where the
I am generating an on-screen figure that has two subplots: one is an image
I have a jasper report that I'm displaying. Now I have an icon to
Short Generating table with barcodes of items. Each item has exact quantity in database
I am creating a simple reporting program using java and iReport (from jasper), which
In generating a select tag for a Boolean value, I use the following code:
Generating inline JavaScript in HTML has always made me feel dirty and after having
When generating dynamic content, which way is better to simply create the HTML and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.