I have an app that needs to use express search and dynamically filter by customer as set by parent app. The issue is using sc_select_where(add) results in this sql format.
select from tbl
where col1 like"%val%", col2 like"%val%",col3 like"%val%" and cust = [cust];
Unfortunately this format still returns all customers. I need to format like:
select from tbl
where cust = [cust] and (col1 like"%val%", col2 like"%val%",col3 like"%val%");
While this returns the correct value my function cannot get sc to query this way.
My func:
if (empty({sc_where_current}))
{
sc_select_where(add) = " where cust_id = “.$usr_num.”";
}
else
{
// strip where str from current query
$modQ = substr({sc_where_current},6);
//trying to clear query
{sc_where_orig}="";
{sc_where_current}="";
// new query properly formatted
sc_select_where() = “WHERE cust_id = “.$usr_num.” AND (”.$modQ.")";
// echo new query for verification.
echo({sc_where_current});
}
So this echos out sc_where_current as the sql string in my second example but sc does not use this query.
Is there a method similar to sc_select_where(add); that would effectively replace the select where clause with my restructured query string?
Thanks