Hi Albert!!!
My friend! Sorry I haven’t skyped in like forever. I will try you later this week.
I know this is a year old post - but I figured out something just today on same thing. You and I always seem to be trying the same things LOL.
On a grid app I am using aes_encryption , so I am not able to directly use the advanced search (or any search) for those fields. (I use AES_DECRYPT in the SQL Select and preparation boxes and other events to do it FYI, but that is another post LOL).
So I also needed to create some ‘fake’ fields in the advanced search, and intercept the values, then slip those in the special WHERE using the AES_DECRYPT). Yes unfortunately , the macros in thr search events do not seem to add anything to WHERE, so this is what I did (SC bug???).
In the grid’s event onScriptInit (NOT the search onScriptInit) - searchname and searchaddress are ‘fake’ fields I created in advanced search…No corresponding fields in DB. (I had to do this because the encryption SQL code that works elsewhere in the app caused errors in search code. The title_search is a global OUT I use in the layout header. I added the code below:
if ( empty({searchname}) AND empty({searchaddress}) )
{
[title_search] = “”;
}
else
{
[title_search] = “Name contains '”.{searchname}." AND Address contains '".{searchaddress};
sc_select_where(add) = " AND CONVERT(AES_DECRYPT(first_name
, @aeskey) USING utf8) LIKE ‘%".{searchname}."%’ AND CONVERT(AES_DECRYPT(address
, @aeskey) USING utf8) LIKE ‘%".{searchaddress}."%’";
}
When the app loads the 2 fake search fields are empty by default. When I click advanced search button, I can put anything I want in those fields. Then the grid processes the search, which really does nothing as far the ‘fake’ fields are concerned. It is when the onScriptInit for the whole app (NOT the search onScriptInit) that the values are added to the WHERE.
This is working for me. So far so good.
Peace everyone,
Jamie