Jump to content
Changes to the Jaspersoft community edition download ×

Logic based on input control values


techvd

Recommended Posts

Hi,

Is it possible to implement some logic based on input control values? Here is an example of what I'd like to do:

1. For my report, I would like to provide some flexibilily in selecting the date range. There are options such as "Last Day," "Last Week,"  "Last Month," and "Generic Date Range." I'd probably implement this as a "Single-select List of Values (Radio)" input control (where each option might simply have a numeric value). Please let me know if there are other, better options.

2. Now based on what user selected for the above, I'd like to tweak the WHERE clause for the query accordingly. How can I do this? Additionally, if user selects "Generic Date Range," I'd like to display 2 additional date fileds. I'm not sure if this kind of auto hide/show functionality is available.

Any help is appreciated.

Thanks,
Vijay

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

I have done some kludgey things in the where clause like having a parameter that is a pull down list of option values...

 

then use these options in your where clause...

 

WHERE

($P{paramOption} = 1 AND database_column=1 ...)

OR

($P{paramOption} = 2 AND database_column=2 ...)

etc

 

not the best SQL ever...but gets the job done...

I think I have also used Case statements with stuff like that too...

 

Link to comment
Share on other sites

Sounds like you're looking for cascading input controls.  I'm in a similar situation.  I read the sticky on it but can't decide if it's working or not by the time I get to the end of the thread.  What I'm trying to do is create some different input controls to select by a division or district and have it pass into the collection parameter the associated locations.  But i need all the options on the same input control dialog so the users can decide which ones to pick.

Link to comment
Share on other sites

techvd,

 

If you want the controls to appear and disappear according to the option selected, you will need to create a custom JSP for that and select it as part of the report unit.

 

manshack_one,

 

The scenario you are descibing is cascading input controls. I see from the cascading input control thread that you have got things working.

 

Sherman

Jaspersoft

Link to comment
Share on other sites

Thanks for your responses and suggestions!

Sherman, it seems like building a custom JSP is the way to go for us. I have a couple of follow up questions.

1. Is there any documentation or examples for this?

2. Given the complexity of my JSP and what kind of input control I implement there, is it possible to then programmatically construct the query? (The where clauses in the query could change significantly depending on the values users enter).

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