Welcome to Knowage Q&A

Here you can read the Q&A history.

To get new community support please go to GitHub discussions (KnowageLabs/Knowage-Server · Discussions · GitHub).

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
...