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