0

I'm stuck in one situation with JasperReports. I have a report query which gets three parameters, just like this:

SELECT DISTINCT
mr.int_grp_no,
mr.grp_no,
ISNULL((select cv_lbl from code_value_mcg where cv_type = 'mem grp type' and cv_code = (select grp_type from mem_group_mcg where group_id = mr.grp_no)), '') as grouptype,
isnull((select reg_date_en from mem_group_mcg where group_id = mr.grp_no), '') as reg_date,
isnull((select name from mem_group_mcg where group_id = mr.int_grp_no), '') as intergroup,
isnull((select name from mem_group_mcg where group_id = mr.grp_no), '') as groupname,
(select count(mid) from mem_reg_mcg where gender = 1 and grp_no = mr.grp_no) as totmale,
(select count(mid) from mem_reg_mcg where gender = 2 and grp_no = mr.grp_no) as totfemale,
((select count(mid) from mem_reg_mcg where gender = 1 and grp_no = mr.grp_no)+(select count(mid) from mem_reg_mcg where gender = 2 and grp_no = mr.grp_no))as total
FROM
dbo.mem_reg_mcg as mr
where $P{condition} and mr.reg_date between $P{Reg_date_from} and $P{Reg_date_to}]

And in the parameter condition I will pass something like mr.mem_in = 2 and mr.grp_no = 3 but when I pass such values in the parameter when the report gets the parameter it generate the parameter as 'mr.mem_in = 2 and mr.grp_no = 3'. The quotation mark is the error in this query. So I'm assuming to get rid of the quotation mark.

So how can I do it?

Any idea will be a very helpful to me.

Alex K
  • 21,796
  • 18
  • 106
  • 231
Nyaro
  • 177
  • 3
  • 7
  • 23
  • You can see my answer on [JasperReports: Passing parameters to query](http://stackoverflow.com/q/11871042/876298) question. You should use *`$P!{condition}`* syntax in this case – Alex K Sep 07 '12 at 11:22
  • Thank you very much Mr. Alex. Its working fine. Thanks for your help. – Nyaro Sep 07 '12 at 11:33

0 Answers0