Hello everyone, I’m new to ODBC, and I have doubts, I would like to create a button to start the filtering, I would not like it to load all data when opening the Browse, even using those parameters in the dictionary.
I want to do a composite search, for example:
name + email.
Like this:
SELECT * FROM cliente WHERE 1=1 AND name ILIKE … AND email ILIKE…
Is this an ABC browse?
If so, I would do this.
In the browse template extension set the filter to 1=0. This will cause the browse to open empty initially with no rows.
In your “search button”, add this code:
BRW1.SetFilter(‘SQL(name LIKE <39>%’ & NameSearchValue & ‘%<39> AND email like <39>%’ & EmailSearchValue & ‘<39>)’)
BRW1.ResetSort(true) !Force a re-load.
You’ll need to handle single quotes in NameSearchValue and EmailSearchValue to keep the syntax correct. There are a number of “quote” methods out there. String theory has one, or roll your own.
This syntax is for MSSQL. If you are using a different back end, the adjust for that.
You can add you
Actually I’m pretty sure that if you use INSTRING() in the filter Clarion will translate that to the appropriate SQL statement. No actual SQL needed. Not sure when that came in.
Thank you very much!
But when I do the search a second time, it gives me error 35, as if I was editing the record, any ideas?
I already tried “Free(BRW.Q)” ResetQueue, Reset.