cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
clarencelew
Level I

How do I add a filter column as a AND criteria

The syntax for Add Filter dictates that the new columns must be in the OR criteria.

Is there some way I can add rules in an iterative way?

dtf<<Add Filter(columns(column <,col>), <Where(clause)>)

Add one or more filter columns in a new OR group.

11 REPLIES 11
ian_jmp
Staff

Re: How do I add a filter column as a AND criteria

Here's one way:

// AND
df << removeLocalDataFilter;
colList = {"age", "sex"};
CMD = 
Expr(
	df = gb << Local Data Filter(
		Add Filter( columns( colsTBD ) )
		)
	);
SubstituteInto(CMD, Expr(colsTBD), colList);
CMD;
newbie_alex
Level III

Re: How do I add a filter column as a AND criteria

I fail to understand the fundamental difference between

 

1)

df = gb << Local Data Filter(Add Filter(columns({"age", "sex", "name"})));

 

and

 

2)

colList = {"age", "sex", "name"};

df = gb << Local Data Filter(Add Filter(columns(colList)));

 

1) works and 2) does not.

 

Would you please explain WHY?

 

Thank you for your help!