query dynamic. is it possible?

By: laz - lazzeronis
query dynamic. is it possible?
2006-07-04 00:25
hello I seek has to provide has my report his query while passing it by parameter because this query is dynamic. how can one make?





By: David Karnowski - karnowski
RE: query dynamic. is it possible?
2006-07-06 09:16
Yes, you'll have to use the "!" in the parameters of your query for the dynamic sections. For example:

select *
from $P!{tableName}
where $P!{columnName} = $P{columnValue}
order by $P!{orderBy}
2006 IR Open Dicussion's picture
Joined: Aug 10 2006 - 3:24am
Last seen: 17 years 1 month ago

2 Answers:

I think it impossible.

I can not passed values for parameter in query.
Ex:
Report query:

SELECT *
FROM Employee
WHERE
EmpName = $P!{P_ID}

P_ID data type: String


And the trouble with me:


How can I passing values to P_ID parameter

from java alpplication ???

ex: P_ID = '6' ==> passing how?

I want to result:

SELECT *
FROM Employee
WHERE
EmpName = '6'

EMAIL: cxtapt@yahoo.co.uk
Post edited by: cxtapt, at: 2006/09/30 03:42
cxtapt's picture
7
Joined: Aug 24 2006 - 5:42pm
Last seen: 17 years 1 month ago
as posted by David Karnowski, that method can actually work but your problems seems to be on the java application side where you're unsure how to pass the parameter. to pass parameter from java app into jasper/ireport, pass it as hashmap. define a key say "P_ID", and pass the whole intended parameter required; (in your case the string). From iReport retrieve it using the "P_ID" key, cast it as String object and concatenate it into your query.
wesleywj2's picture
Joined: Oct 2 2006 - 7:38pm
Last seen: 17 years 3 days ago
Feedback