Jump to content
Changes to the Jaspersoft community edition download ×

Single Select Query Always returns the first value not the one selected


milltj
Go to solution Solved by mgeise,

Recommended Posts

 

Hi:


I am new to Jasperserver and have successfully deployed my first report.  My report relies on three input parameters (1 ID and 2 Date fields). My Date input controls are working great, but I am having a problem with the ID input control. I started by defining it as a simple Text entry box and it works great. Right now there are only 3 different ID's to choose from, but as the table grows, I can't expect the users to remember all of the ID's.  So  I defined a Single Select Query input box which pulls 2 fields from a table, one is an ID number and the other is a Company name.  When I run the report it correctly populates the box and I am able to select any of the entries, but when the report runs it always uses the ID for the first entry in the drop down box.  My Input box is defined with the following parameters:

Mandatory: true
Visible: true

Query: SELECT ID, COMPANY_NAME FROM TABLE;
Value Column: ID
Visible Column: COMPANY_NAME

I am stumped as to why it is doing this.  I would appreciate any help I can get on this one!

Thanks!

- Tim

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

Things that could be happening:

  1. It is actually using the default value for the parameter as defined in the JRXML because the name of the input control does not match the parameter name that you are trying to populate, or
  2. The query is not actually using the parameter when it is running (Maybe you were testing something and pulled out the $P{parameter_name} from the query and replaced it with a value)
  3. Maybe the IDs coming from your DB are Strings and those that you had defined before (and that your query is expecting) are integers or vice versa.

We have not had any complaints that the single select query based input controls do not work.  You could try printing out the parameter value on your report just to verify the value (doing so with the list input control and comparing them, may tell you something).

 

Link to comment
Share on other sites

Thanks, for the response, I went in and found that it was an issue with the Datatype.  The ID is an integer and the Parameter was defined as a String. Once I changed the parameter to be an Integer, it worked!

 

Thanks again!

-Tim

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