Jump to content
We've recently updated our Privacy Statement, available here ×

How to use parameters for the WHERE clause


2005 IR Help

Recommended Posts

By: Alex - aartini

How to use parameters for the WHERE clause

2005-08-03 15:08

I'd like to define more than one condition in a WHERE clause.

 

So I've defined query with:

where $P{where}

 

"Where" parameter's defined as java.lang.String and "is for prompting".

When I run report and I use:

parameter.put ("where", condition")

report returns:

"the document has no page"

but if I execute the complete query (also with where condition that I pass via parameter) I get data.

It seems the report executes a query different from how I think it should do.

 

Is it possible to pass a string to the report containing all where condition?

 

Is it possible using where $P{cond} ?

cond may be "test1 and test2 and test3....

 

I'd appreciate any comment or help.

 

Alex

 

 

 

 

 

 

 

 

 

By: neptune22 - neptune22

RE: How to use parameters for the WHERE claus

2005-08-03 22:44

SELECT * FROM TABLE

$P!{WHERE}

 

 

 

 

 

 

 

By: Marcia - marciapcp

RE: How to use parameters for the WHERE claus

2005-08-04 04:55

SELECT FIELD1,FIELD2,FIELD3

FROM TABLE

WHERE FIELDn = $P{PARAMETER}

 

But if you are using the Wizard tool you must pass a value to this parameter and after, with the report on screen, you can access the select and change to take the parameter passed.(like the example)

Remember that you must have this parameter at Parameters List and to test the report inside the software this one must be for prompt.

 

 

 

 

By: Alex - aartini

RE: How to use parameters for the WHERE claus

2005-08-05 11:56

Thanks for your help,

 

I will try to do it.

 

But someone can explain me the difference using

$P{str} and $P!{str}?

In which situations I have to use "!"?

 

Thanks

 

 

Alex

 

 

 

 

By: armov - armov

RE: How to use parameters for the WHERE claus

2005-08-05 23:47

The $P! use t when you have to evaluate the expression after the query...

 

 

 

 

By: armov - armov

RE: How to use parameters for the WHERE clause

2005-08-04 06:44

Why don't you just pass over the whole query? I think is better.

 

inside iReport:

write in the query: $P!{[query]}. Notice the ! sign.

 

outside iReport:

pm.put("[parameter name]",new String"[query]");

 

 

 

 

By: Burcu - naughty_girl

RE: How to use parameters for the WHERE clause

2005-08-26 00:56

Where do you mean ouside iReport?Where should i write this?I will be grateful if you help me.

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