This is definitely possible, but have you ruled out using a (global) data filter? This would let you--and those who are not scripters--enter queries easily, saving your favorites, and saving the filter off to the data table for future use.
Once favorites exist, they are easily accessible from a drop-down menu.
This is a really easy way to go (and to teach to your script-averse co-workers, who may be the end-users?). The cell-based approach will require end-users to enter legitimate syntax--far from guaranteed.
Once you've set this up, the users just need to pick from a drop-down. More advanced users can add their own filters. Selections are made immediately, so all that remains is actually creating the subset.
If, on the other hand, you need to stick with your initial approach, here is a way to do it:
Names Default To Here(1);
//setup
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << new column("add");
dt:add[1] = " & :height < 65";
//using \[ and ]\ to delimit the initial :sex == "F" string means you don't have to escape double-quotes.
query text = "\[:sex == "F"]\" || dt:add[1];
//parse and substitute the actual query text in for _TXT_ in the first expression below, and evaluate
eval (substitute(
expr ( dt << Select Where( _TXT_ ) ),
expr( _TXT_),
parse(query text)
));
dtSub = dt << subset (selected rows(1), selected columns(0));
Cheers,
Brady