Welcome to Knowage Q&A, where you can ask questions and receive answers from other members of the community.
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
in Data Set by (690 points)

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
by (4.9k points)
noted with thx. Merry christmas
...