Jump to content

Making columns appear/disappear based on query (jaspersoft ireport designer 5.6.0)


rawadbaz

Recommended Posts

I have two tables in my database, in which i'm getting from one 2 (A,B) fields and from the other 6 fields (C,D,E,F,G,H).

What i want is that based on a parameter inserted by the user either a report (A,B,C,D,E) will appear or (A,B,F,G,H).
So two fields from the first table are constant and will appear, however based on the user input parameter, either C,D,E will appear with A,B. Or F,G,H.

Any idea on what method should i follow please?
 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I don't think that could be done with iReport and iReport development has already ended so there's little chance that it'll get supported.

You'll probably have to create a program yourself that uses JasperReports library to create you report. You can filter datasource depending on the parameter.

 

Link to comment
Share on other sites

Why don't you just select all your needed fields in the query (select A,B,C,D,E,F,G,H) , and, depending on the parameters given, let some fields be shown or hidden? You can use "printWhenExpression" for this, e.g. for the field C: printWhenExpression= $P{showC}.equals("true"). So the user will only see the field "C" when the parameter "showC" is "true".

In this way you can show only the requested fields.

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...