Sc_select_where doesn't work

Hi
I 've a grid with a query. It’s working.

In onscriptinit I include this:

if ($vcondition!=’’){
if (empty({sc_where_current}))
{
sc_select_where(add) = "where ".$vcondition;
}
else
{
sc_select_where(add) = "AND ".$vcondition;
}
}

and the result is:

select count(*) from (SELECT … FROM table WHERE initial_condition ) nm_sel_esp where tipo_documento = ‘14’ (this last part is added via sc_select_where)

It’s not changing where clause…why not?

I use SC 9.9.024

Dear @aamartinezz,

After tests carried out in the most recent version of Scriptcase (9.10.011), the dynamic addition of the WHERE clause in the main SELECT of the Grid application occurred as expected.

In the image below, we perform a simple conditional to add the WHERE clause depending on the application’s original SELECT. As the application’s original SQL already contains a WHERE clause, it enters the “else” and adds one more, as can be seen in the application’s debug.

Please, if possible, check whether in the latest version of Scriptcase in your environment the macro will work normally.

Best regards!