onScriptInit does not pass updates to global vars to SQL

I started with creating grid application that shows results, I need to pull data from date range so I had to create to custom fields in search fields are called {search_start} and {search_end}
When advanced search form is submitted values of these variables should be sent to the grid and become available in onScriptInit event.
They do became available when I echo them inside onScriptInit I see their values, I then send their values on to global variable [app_date_start] and [app_date_end]
These globals are used in MySQL statement that pulls data in to the Grid, but Grid never updates them and shows blanks in SQL statement.

The issue is that I am updating values of [global] vars used inside onScriptInit and according to description of this event, these updates happen before SQL is executed, but changes made never make it in to SQL statement. But global variables do get values properly.

I tried another option where I tried to update mysql WHERE statement inside onScriptInit , using sc_select_where and this had no impact at all, this function does not do anything - it does not update WHERE clause.

This feature worked fine in previous versions, I have code relying on this functionality and all of it broke down

In some cases you need to use custom variable inside search and somehow send that variable to SQL statement, this has been the only way I was able to do it, catch Search for variable value inside onScriptInit, give it to global variable and because global is used in the SQL statement and onScriptInit happens before SQL is executed, this variable made it in to the query.

Hi Proper.
I’m facing this exact issue right now.
The global variable gets the value I assigned to it in the OnScriptInit event (checked with sc_alert) but SQL statement, which contains this global variable, is not updated.
Have you been able to find a fix for this?
Thx

Where you change the Session vars, do a sc_redir back to the grid.

I ended up working wit hwith “sc_select_where(add)” in “OnScriptInit” and creating my own WHERE clause. It works now perfectly. Thanks for your advice.
I have now another issue: in “OnScriptInit”, I assigned a global var like this “[MyVar] = “http://myurl.com”;”
Then in a javascript button, I can’t figure out how to get the alue of [MyVar] to use it in “window.open()” javascript function.