Page 1 of 1

filter on null boolean field

Posted: Wed 04 Jun 2014 20:08
by ccmcbride
I have a table with boolean field, some of the values are null, not false.
I have a table component, with filter of fieldname = false.

no records are being returned (out of 10 records, 8 have null values, 2 have false values, and I should be getting them all).
Using delphi 2010, Sdac 5.10.0.8.
is there a fix/workaround?

Re: filter on null boolean field

Posted: Thu 05 Jun 2014 09:56
by azyk
Hello,

We couldn't reproduce the problem. Please try to compose a small sample to demonstrate the problem and send it to andreyz*devart*com.

Re: filter on null boolean field

Posted: Thu 05 Jun 2014 19:06
by ccmcbride
recreated, zipped and emailed.

Re: filter on null boolean field

Posted: Tue 10 Jun 2014 11:34
by azyk
Hello,

We have investigated the provided project. Records from the boolean field value null don't get to your filter, since the null and False values are determined by SQL Server as different values. Therefore, to filter records with null and False values, you should set the TMSTable.Filter property to 'sys_isdeleted = false or sys_isdeleted is null'.

Re: filter on null boolean field

Posted: Tue 10 Jun 2014 15:21
by ccmcbride
then what is the difference between a filter, and filtersql?

Re: filter on null boolean field

Posted: Wed 11 Jun 2014 14:33
by azyk
Hello,

The TMSTable.FilterSQL value is added to the WHERE clause for the SELECT query. I.e. filtration occurs on the server side.

The value of the TMSTable.Filter property is used on the client side.

Re: filter on null boolean field

Posted: Wed 11 Jun 2014 19:44
by ccmcbride
if it's used on the client side, then what does it matter what mssql returns? wouldn't it return all records, then be filtered on the value?

Re: filter on null boolean field

Posted: Thu 12 Jun 2014 10:37
by azyk
In this case, SQL Server will return all the records to the dataset. The dataset will contain all the records, but will return only those, that meet the filter condition.

Re: filter on null boolean field

Posted: Thu 12 Jun 2014 15:45
by ccmcbride
okay, so if I open the dataset, thereby getting all the records, THEN apply the filter, would that work as I expect?

Re: filter on null boolean field

Posted: Fri 20 Jun 2014 14:20
by azyk
Functionality of local filter is similar to functionality of the SQL Server filter. Therefore, when the dataset retrieves all the records, the local filter won't pass records with null values if they are not specified via "is null". Therefore, if you want to retrieve both records with False and null values, you should modify the filter condition to 'sys_isdeleted = false or sys_isdeleted is null'.