Bug with Refined Search

If you use an SQL SELECT like this one

SELECT
Field1,
Field2,
Field3
FROM
Table
WHERE
Field1 =1 OR Field2 = 2 OR Field3 = 3

in a GRID the Refined Search will fail, and in some case the Search (Quick, Advanced and Dynamic) will also fail because the SELECT generated by SC will be

SELECT
Field1,
Field2,
Field3
FROM
Table
WHERE
Field1 =1 OR Field2 = 2 OR Field3 = 3 AND Field1 IN (‘value’)

The AND will not be executed if Field3 = 3, the correct SELECT should be

SELECT
Field1,
Field2,
Field3
FROM
Table
WHERE
(Field1 =1 OR Field2 = 2 OR Field3 = 3) AND Field1 IN (‘value’)

Until SC fix this, its a good practice to always but your WHERE OR HAVING clause in () to prevent this kind of behavior

1 Curtida

I still having same problem in refined search when I have global variable in SQL.

Hopping NM fix it ASAP.

regards