Hi,
I am trying to use a multi-select parameter for my report. But the concatenated query result does not pass through the main query.
Step1:
The parameter query lists all document types using check box for filter type,
SELECT 0,'All' as ord2, '','1' as ord1
union
select tm2.id,tm2.TAXVALDESC as ord2,'','2' as ord1 from sipo_db.dnrf_values dv
LEFT JOIN sipo_db.dnrf_prefixes dp ON dp.dnrf_value_id=dv.id
LEFT JOIN sipo_db.tm_m_ibm_taxdtls tm1 ON tm1.id=dv.business_unit
LEFT JOIN sipo_db.tm_m_ibm_taxdtls tm2 ON tm2.id=dp.document_id
where dv.business_unit=609 and tm2.id <> ''
GROUP BY tm2.TAXVALDESC
order by ord1,ord2;
Step 2:
Below is the main procedure which executes when report is called. The selected document types are passed
CREATE PROCEDURE sp_DBR_DEMAND_SYS_33_v1_11
(getdoctype_test int)
BEGIN
create temporary table data_tmp(id int);
set @vSQL = concat('INSERT INTO ','data_tmp', ' VALUES(\'', REPLACE(getdoctype_test, ',', '\'),(\''), '\')');
prepare stmt from @vSQL;
execute stmt;
deallocate prepare stmt;
The result of the temp table i am passing into my where condition as below,
WHERE dv.business_unit=609 and dp.document_id in (select id from data_tmp);
When i try to print the result using select id from data_tmp; i get 628,612, not sure why the report still appears blank.
Thanks