There is BUG in SC9.4

After breaking my head with my code finally using inspect, I found some issues.
I am using a form with multirecords. I am using the Where Clause in the form / SQL. The clause is “customer_id_from_master = [cust_row_id]”. I am setting the [cust_row_id] as a global in the same form’s applicationinit event as follows
$cust_row_id=0;
$idProduct=0;

sc_set_global ([cust_row_id]);
 sc_set_global ([idProduct]);

 The following if check was added after the error cropped out . But still the same error
 if(isset([cust_row_id])==false)
{
    [cust_row_id]=0;
}

Whatever be the case, I am getting this error found using INSPECT in CHROME:
$(function() {
scAjaxShowErrorDisplay_toast(“table”, scAjaxFixedErrorSql(“Error while accessing the database<BR>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1<BR>{SC_DB_ERROR_INI}View SQL{SC_DB_ERROR_MID}SELECT count(*) AS countTest from customer_wishlist where customer_id_from_master = {SC_DB_ERROR_CLS}Close{SC_DB_ERROR_END}”));

})
This error goes away when I remove the Where Clause value in settings
Now the issue can be any one of the following

  1. Not to use Global Variables in the where clause. If that is the case then how to filter the records in the form / multiple record
  2. ​​​​​​Application Init Does not get executed before the SQL is executed (AM I missing something here )
    THE HELP OF APPLICATIONINIT Says "This event occurs before the application execute the SQL, and execute only once. It is used to do verification of variables, and security verification. Ex: if ([glo_var_department] != ‘financial’){ sc_redir(app_x.php); "

IF both above are ok, then I am making mistake somewhere or there is a bug in SC?

Suresh

You don’t need to use sc_set_global. So [cust_row_id] is enough to assign a value to a global variable. But if you do use sc_set_global you do should not use the [] symbols so it’s
[cust_row_id]=0 or

$cust_row_id=0;
sc_set_global($cust_row_id);

Not sure if it will solve your issue though.

Hi aducom;
Thanks for your response.
Well for one : i read in the documentation that sc_set_global is going to be discontinued
therefore i changed my code to what you have suggested.
But the error was else where. i suspected that the issue was with the global variable. but after seeing the error message (pasted above) i did some more digging
And realised that the where clause in the form sql setting should not be customer_id_from_master = [cust_row_id] but customer_id_from_master = ‘[cust_row_id]’ (note the single quote before and after the global variable ). Naturally, SC is a RAD tool and tries to convert the Where clause into a string. And somewhere in the process of conversion they are making 0 as null or a pHP quirk. what ever by adding the quotes the issue is resolved.
And the confusion got compounded with the fact that the customer_id is an integer.
Any way, either I missed the documentation or something Thanks once again