ReFilter() does not accept empty string?

ReFilter() does not accept empty string?

Postby dutch » Thu May 31, 2018 5: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 19.01 / 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)
User avatar
dutch
 
Posts: 1548
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: ReFilter() does not accept empty string?

Postby Armando » Thu May 31, 2018 3:39 pm

Dutch:

With MySQL I use

Code: Select all  Expand view  RUN

    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
User avatar
Armando
 
Posts: 3231
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: ReFilter() does not accept empty string?

Postby nageswaragunupudi » Thu May 31, 2018 3: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
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ReFilter() does not accept empty string?

Postby dutch » 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 19.01 / 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)
User avatar
dutch
 
Posts: 1548
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: ReFilter() does not accept empty string?

Postby nageswaragunupudi » Fri Jun 01, 2018 4: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
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ReFilter() does not accept empty string?

Postby dutch » Fri Jun 01, 2018 5: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 19.01 / 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)
User avatar
dutch
 
Posts: 1548
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 58 guests