0 votes
1 view

I have the following working sample for Javascript, but I am not sure how to do the same thing with groovy  . Can provide some sample ? 

//javascript 

if( parameters.get('client_id') == "'ALL'" ) 

 { 

   query = query.replaceAll('client_id_where_clause', '');

 }

else

{

  query = query.replaceAll('client_id_where_clause', ' and asum."CLIENTID"= \\$P{client_id} ');

}

Environment knowage 8.0.1 , windows 10
asked Nov 24, 2021 in Data Set by kstang (690 points) | 1 view

1 Answer

0 votes
Dear kstang,

basing on your case, this is an example of a similar groovy script (I'm using foodmart demo dataset):

def condition1 = "";
def family = parameters.get('FAMILY');

condition1 +=" and pc.product_family = "+family;

query = query.replaceAll("PLACEHOLDER_FAMILY", condition1);

Regards

Matteo
answered Dec 20, 2021 by matmassa (4,870 points)
noted with thx. Merry christmas
1,553 questions
1,017 answers
2,037 comments
2,567 users