Jump to content
JasperReports Library 7.0 is now available ×

help need to add parameter to query


2004 IR Help

Recommended Posts

By: vcd04 - violeth04

help need to add parameter to query

2004-08-26 11:49

Hi,

I need to add a parameter to the report, I select view_> report query and add the parameter problem is that there is no way to save the query changes, in the tutorial when they do this there is a button "Save changes to query" I don't have that button, I am using ireports 0.3.2.

 

I tried going ahead anyway, add the parameter, (as soon as I start making the changes the ok button gets disabled, once I finish, I click on "REad Fields" but nothing happens, I tried also unselecting "automatically retrieve fields, then a message says enter your query and press "read fields" which I do again but nothing happens.

 

I have defined already the parameter using view->report parameters but still the problem is that I can't save any changes to the query.

 

Any ideas? thanks

 

 

 

 

By: Andrew McLaughlin - pik0

RE: help need to add parameter to query

2004-08-26 12:05

I'm running the same version of iReports. In my View/Report Query dialog, it only has buttons for "Cancel" and "OK". I don't have any other save button. Do you have that?

 

Otherwise, you should just be able reference the parameters in your where logic as $P{parm_name}...

 

Piko

 

 

 

 

By: vcd04 - violeth04

RE: help need to add parameter to query

2004-08-26 17:58

no, Id on't have any other save button either, that is the problem, I change the query so I add my parameter in the where clause : $P{param_name}, then I close the window (using the X in the upper right corner), save the report, and is ok, but if I open the report query again or if I close the report, and open the report query again, it did not save the change of adding the parameter in the where clause. so how I am going to do any change in the query and save it?

 

How do you update and save your queries?

 

 

 

 

By: Andrew McLaughlin - pik0

RE: help need to add parameter to query

2004-08-26 22:38

You don't have an "OK" button in the lower right corner of that dialog? If that's not there, than I'd consider reinstalling iReports. Or, perhaps you should considering downloading the dev version.

 

Can you email me a screen shot of what you are seeing?

 

Piko

 

 

 

 

By: vcd04 - violeth04

RE: help need to add parameter to query

2004-09-10 15:47

yes, there is an "Ok" button in the lower right corner of the dialog screen but is disabled, it gets disabled as soon as I start modifying the query,so I can never click ok after I complete the change, I took a screen shot, how can I e-mail it to you?

 

(What e-mail address)

Thanks

Violet

 

 

 

 

 

By: mir_shajahan - comp_shajahan

RE: help need to add parameter to query

2004-10-21 00:59

Hai...

I am running the same problems.... can anyone plz show me the solution plz...

 

Thank you....

 

<< aMir >>

 

 

 

 

By: Matteo - jyotaro

RE: help need to add parameter to query

2004-10-21 01:23

You need to create the parameter first (view/report parameters), then you could change the query (Datasource/Report query) and execute it (Read fields) as to retrieve the fields extracted. Only at that point the "ok" button is enabled.

Bye,

Matteo

 

 

 

 

By: mir_shajahan - comp_shajahan

RE: help need to add parameter to query

2004-10-21 05:58

Hello Matteo,

Thanks for the reply..... I just tried ur solution but it does not work... Let me explain what happen..

 

First I create a parameter

C_Project_ID - java.lang.Double

 

Second in the report query :-

SELECT * FROM C_Project

WHERE C_Project.C_Project_ID = $P!{C_Project_ID}

 

But the problems when I click Read Field,...the following error message appears:-

 

General Problems:Sourced file: inline evaluation of: bshCalculator.evalution(1080);":null Check username and password; is the DBMS active?!

 

I am totally blank? Dont know what could be the problem.. ?

 

Any suggestion is appreciated..Thank you..

 

<< aMir >>

 

 

 

 

By: Matteo - jyotaro

RE: help need to add parameter to query

2004-10-21 07:16

I don't use double parameters, but only string one. I've had problems too using double parameters. Try to change it in java.lang.string; the query seems to be correct.

 

For ex. I have a parameter MESE java.lang.string as new String("'1'") and the query is

select pt.description, st.store_name, sum(sa.units_sold) units_sold, sum(sa.dollars_sold) dollars_sold, ti.month, ti.year from

store_dimension st INNER JOIN sales_fact_m sa ON

st.store_key=sa.store_key INNER JOIN time_dimension ti

on sa.time_key=ti.time_key INNER JOIN product_dimension pt ON sa.product_key=pt.product_key

where ti.month in ($P!{MESE}) and ti.year in ($P!{ANNO})

group by

ti.year, ti.month, pt.description, st.store_name.

 

Month is an integer value.

 

Matteo

 

 

 

 

By: Rick Millar - rmillar

RE: help need to add parameter to query

2004-10-21 08:51

In my experience, the read fields functionality will not work corrrectly once you've added parameter references. I believe this is because it simply executed the query, with out evaluating the parameter references. What gets passed to the SQL engine is the string text of your parameter references, not the value of the parameter itself.

 

If you want to make sure your query is working and read in the fields, you must first remove parameter references and susitute actual values in the query. Once you get the fields read in and registered, then put the parameter references back in and save query to report. From then on, to test your query, you will need to compile and preview.

 

 

 

 

 

By: Rick Millar - rmillar

RE: help need to add parameter to query

2004-10-21 08:56

Also, with the "null Check username and password; is the DBMS active?! " error message your getting, make sure you have an active connection. First make sure you have a datasource defined under the Datasources menu, then under the Build menu there is a "Set Active Connection" option to choose which datasource you want to use.

 

 

 

 

By: Matteo - jyotaro

RE: help need to add parameter to query

2004-10-21 07:17

In the example above... obviously I have another parameter ANNO that acts the same as MESE.

Bye,

Matteo

 

 

 

 

By: Nick C - zcrar70

RE: help need to add parameter to query

2004-10-26 03:36

I am having the same problem, and it sounds like a bug - queries with parameters works when the parameter is a String, but fail when it is a numerical value...

 

 

 

 

By: Giulio Toffoli - gt78

RE: help need to add parameter to query

2004-10-26 04:01

 

set a default value for all parameters used in the query.

 

Giulio

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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