FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ReFilter() does not accept empty string?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
ReFilter() does not accept empty string?
Posted: Thu May 31, 2018 05:30 AM

Dear All,

I use FWMARIADB and use SetFilter() as below

oRs := oCn:RowSet('customer')
oRs:SetFilter('status= ?', {"M"'} ) // it work for which has status="M"

oRs:ReFilter({" "}) // it doesn't work which has status=" "

How does I Refilter with empty string?

Thanks in advance,

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: ReFilter() does not accept empty string?
Posted: Thu May 31, 2018 03:39 PM
Dutch:

With MySQL I use

Code (fw): Select all Collapse
    oRs:Filter := adFilterNone


Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ReFilter() does not accept empty string?
Posted: Thu May 31, 2018 03:46 PM
oRs:ReFilter({" "}) // it doesn't work which has status=" "

How does I Refilter with empty string?

Refilter does not work with empty string.
Very likely the value that is stored is trimmed and is "" or NULL but not " ".

Only way is
oRs:SetFilter( "PADR( status, 1 ) = ' '" )

My advice is not to rely on empty values. Instead you store a different value to indicate a 3rd value.
Like "M" for married, "S" for single, "U" for unknown.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: ReFilter() does not accept empty string?
Posted: Thu May 31, 2018 11:39 PM
Dear Mr.Rao,

Thank you so much for your help and advice. I've got it now.
nageswaragunupudi wrote:
oRs:ReFilter({" "}) // it doesn't work which has status=" "

How does I Refilter with empty string?

Refilter does not work with empty string.
Very likely the value that is stored is trimmed and is "" or NULL but not " ".

Only way is
oRs:SetFilter( "PADR( status, 1 ) = ' '" )

My advice is not to rely on empty values. Instead you store a different value to indicate a 3rd value.
Like "M" for married, "S" for single, "U" for unknown.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: ReFilter() does not accept empty string?
Posted: Fri Jun 01, 2018 04:57 AM

Refiltering with an empty string will work in FWH 18.04, if the field is CHAR field (not VARCHAR)

Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: ReFilter() does not accept empty string?
Posted: Fri Jun 01, 2018 05:13 AM
Dear Mr.Rao,

Like +1
nageswaragunupudi wrote:Refiltering with an empty string will work in FWH 18.04, if the field is CHAR field (not VARCHAR)
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion