I like to follow a different path avoiding unintuitive eval parse combinations, where I find them quite useful for other purposes.
Often I have complex queries (built in plain SQL by other Tools like SQL developer). And I Need to modify some variables.
The attached example Shows how it works with big class datatable, howewer it would work for all ODBC Connections in a similar way.
Simply I prepare my Connection string (not used here) and the SQL Query in a string variable, given to the "New SQL Query".object.
I use "assign" (instead of "=") because it works nice for large queries and Code folding.
And I'm more flexible for also using open database function, or processing the SQL in other ways.
Usually the double quotes are not needed in a plain SQL (and I try to avoid also), unless you have names with spaces etc. like "Big Class".
Names Default To Here( 1 );
cdt = Open( "$Sample_Data\Big Class.jmp" );
age = "15";
// define custom SQL with placeholder
Assign( sql_str, "SELECT t1.name, t1.age, t1.sex, t1.height,
t1.weight
FROM \!"Big Class\!" t1
WHERE ( ( ( t1.age IN ( &age ) ) ) ) ;" );
// fill placeholder
Substitute Into( sql_str, "&age", "15" );
// execute query
dt_age = New SQL Query( Version( 130 ), Connection( "JMP" ), JMP Tables( cdt ), QueryName( "aged" || "_" || age ), CustomSQL( sql_str ) ) << Run;
Georg