Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

EMCA Script for multi value list parameter

$
0
0
Hi ,

I am using EMCA script to change the query at run time or based on parameter selection.

below is my country parameter query which is static and do not use EMCA :

select '-None-' as country
union
SELECT distinct
country
FROM customer
ORDER BY country

And I need to display the states based on the selection of the country parameter, and if user selects "-None-" then I need to run the separate query, for that I have written below EMCA script:

function computeQuery (query, queryName, dataRow)
{
var sCountry=dataRow.get("sCountry");
if(dataRow.get("sCountry") == '-None-')
{
query=" select 'None1' as state_province";
}
if(dataRow.get("sCountry") !='-None-')
{
query="SELECT distinct `state_province` AS state_province FROM customer WHERE country IN (${sCountry}) ";
}

if(dataRow.get("sCountry") == null)
{
query="select '-None5-' as state_province";
}


return query;
}





Problem : When I use single select of country parameter then switching of query is working fine.
but when i make country as multi valued parameter then only condition
if(dataRow.get("sCountry") !='-None-') is getting executed , even we select "-None-" in the parameter value list.

I think this might be because object data type returned by the country parameter, But I am not sure.

Please help me to solve this problem , how switching of query can be performed when the filter is multiselect.

Thanks

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>