OK, here are seven methods that don’t work. I haven’t found a method that does yet. In all cases the filter_string and the date_string are bound. This is the Oracle driver, though I don’t think it should make much difference. Date_string is just a string representing a date (like 2024-10-29) selected from a drop-down. As you would expect, where the filtering is done after the browse opens the unfiltered list appears before you try to filter it using the dropdown.
There are some things in there I cannot explain. For example, the SQL() doesn’t seem to recognize the closing bracket as the end of what it should take literally. I suspect the replacement of & with || (the concatenation operator in Oracle) is specific to Oracle.
I don’t know why the PROP:SQLFilter wraps stuff in quotation marks.
I suspect that the ones with the BIND errors are because it cannot figure out what to do with TRUNC and DATE when they are not wrapped in SQL().
I don’t know why some of them it decides to do a <> ‘’.
Method 2, the forum has translated the 80 character empty string back to a single character string.
I’m probably missing something blindingly obvious, but…
Jon
What I want to send to the server is:
…where trunc(dt) = date’2024-10-31’ order by dt
Method 1:
filter_string = ‘trunc(dt) = date’‘’ & date_string & ‘’‘’
browse filter = SQL(filter_string)
SQL sent: SELECT A.ID, A.DT FROM TESTJON.“DATE_FILTER” A WHERE ( filter_string ) ORDER BY A.DT
Result: Oracle 920 error (invalid relational operator)
Method 2:
filter_string = ‘trunc(dt) = date’‘’ & date_string & ‘’‘’
browse filter = filter_string
SQL sent: SELECT A.ID, A.DT FROM TESTJON.“DATE_FILTER” A WHERE ( ’ ’ <> ‘’ ) ORDER BY A.DT
Result: No error, no data
Method 3:
filter_string = ‘trunc(dt) = date’‘’ & date_string & ‘’‘’
browse filter – None
SetFilter: BRW1.SetFilter(‘SQL(filter_string)’)
SQL sent: SELECT A.ID, A.DT FROM TESTJON.“DATE_FILTER” A WHERE ( filter_string ) ORDER BY A.DT
Result: Oracle 920 error (invalid relational operator)
Method 4:
filter_string = ‘trunc(dt) = date’‘’ & date_string & ‘’‘’
browse filter – None
SetFilter: BRW1.SetFilter(filter_string) (also called after resetting the filter_string)
SQL sent: SELECT A.ID, A.DT FROM TESTJON.“DATE_FILTER” A WHERE ( A.DT >= :1 ) ORDER BY A.DT
Result: Clarion error “Bind has not been called…filter and range limits ignored”, all rows shown
Method 5:
Browse filter = SQL(trunc(dt) = date’) & date_string & SQL(‘)
or SQL(trunc(dt) = date’‘’) & date_string & SQL(‘’‘’)
Result: Clarion error “Invalid expression for evaulate…filter and range limits ignored”, all rows shown
Method 6:
Browse filter = SQL(‘trunc(dt) = date’‘’) & date_string & SQL(‘’‘’)
SQL sent: SELECT A.ID, A.DT FROM TESTJON.“DATE_FILTER” A WHERE ( ‘trunc(dt) = date’‘’ || ’ ’ || ‘’‘’ <> ‘’ )
Result: no data
Method 7:
filter_string = ‘trunc(dt) = date’‘’ & date_string & ‘’‘’
or 'trunc(dt) = date & date_string ’
brw1{PROP:SQLfilter} = filter_string
SQL sent: SELECT A.ID, A.DT FROM TESTJON.“DATE_FILTER” A WHERE ( A.DT >= :1 ) ORDER BY A.DT
Result: all data, no filter