SQL Filter behaving differently than expected
Posted: Thu 16 Oct 2014 10:46
Hi all,
Just to let you know I came across this problem.
I have a query SELECT * FROM GOODS where PRODUCT = 'APPLE'
This returns a number of records.
I've set my FILTER SQL TO COLOR = 'GREEN' OR COLOR = 'RED'
This returns all Green Apples and ALL Red Fruits.
I expected it to return only Green and Red Apples.
To solve this you have to set FILTERSQL TO (COLOR = 'GREEN' OR COLOR = 'RED')
I was under the impression that a query returns a set of given records.
FilterSQL would act as a filter, and not possibly add records to that set query.
Devart explained that the way it works it that FILTERSQL is added as 'AND ' + FILTERSQL.
So setting the Filter SQL to COLOR = 'GREEN' OR COLOR = 'RED' result in the query becoming : SELECT * FROM GOODS WHERE (PRODUCT = 'APPLE' ) AND COLOR = 'GREEN' OR COLOR = 'RED'
Devart doesn't want to change this behavior as they believe everybody is expecting this behavior.
I'm now changing all my FilterSQL to include brackets before and after the condition.
Please be warned about this, not only for MSSQL but for all the products.
Am I the only one disagreeing about this with Devart ?
Kind regards,
Erik.
Just to let you know I came across this problem.
I have a query SELECT * FROM GOODS where PRODUCT = 'APPLE'
This returns a number of records.
I've set my FILTER SQL TO COLOR = 'GREEN' OR COLOR = 'RED'
This returns all Green Apples and ALL Red Fruits.
I expected it to return only Green and Red Apples.
To solve this you have to set FILTERSQL TO (COLOR = 'GREEN' OR COLOR = 'RED')
I was under the impression that a query returns a set of given records.
FilterSQL would act as a filter, and not possibly add records to that set query.
Devart explained that the way it works it that FILTERSQL is added as 'AND ' + FILTERSQL.
So setting the Filter SQL to COLOR = 'GREEN' OR COLOR = 'RED' result in the query becoming : SELECT * FROM GOODS WHERE (PRODUCT = 'APPLE' ) AND COLOR = 'GREEN' OR COLOR = 'RED'
Devart doesn't want to change this behavior as they believe everybody is expecting this behavior.
I'm now changing all my FilterSQL to include brackets before and after the condition.
Please be warned about this, not only for MSSQL but for all the products.
Am I the only one disagreeing about this with Devart ?
Kind regards,
Erik.