Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #7728

Re: Setfilter and date

From Martin <spam@spam.spam>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Setfilter and date
Date 2015-02-09 10:34 +0000
Organization A noiseless patient Spider
Message-ID <mba2dm$ae4$1@dont-email.me> (permalink)
References <93e9d0b6-312b-4955-8a66-dc87bf322bca@k36g2000yqb.googlegroups.com> <da7b356d-6066-4463-bb42-1591425fdf53@googlegroups.com>

Show all headers | View raw


For dates always use DTOS() if you need to string a date


"DToS(_Field->DateField) ='"+DToS(MyDate)+"'"

On 08/02/2015 03:38, akaralis@otenet.gr wrote:
> Τη Τετάρτη, 28 Απριλίου 2010 - 2:09:23 π.μ. UTC+3, ο χρήστης Stefan L έγραψε:
>> Hi,
>>
>> I Have 2 posts in a database with the field "NYKALDAT" (date)
>> containing
>> Post 1 = 2010-05-17
>> Post 2 = 2010-04-08
>>
>> // Visual Objects (Version 2.8. Build 2.2828), Version 2.8 SP2
>>
>> Now I try to filter the database like this:
>> ?  DTOC(Today()) // Gives "2010-04-28"
>> ?  cFilter := "NYKALDAT" + " < " +  DTOC(Today()) // Gives "NYKALDAT <
>> 2010-04-28"
>>     uCB := &("{||" + cFilter + "}") // Codeblock
>> ?  SELF:oSFSub_Form1:Server:SetFilter(uCB ,cFilter) // Gives .T.
>>     SELF:oSFSub_Form1:Server:GoTop()
>>
>>     DO WHILE !SELF:oSFSub_Form1:Server:EOF
>> ?     SELF:oSFSub_Form1:Server:Recno // No records! Should show Post
>> 2.
>>        SELF:oSFSub_Form1:Server:Skip()
>>     ENDDO
>>
>> Now I try to change the date format like this:
>>     cDate := GetDateFormat()
>>     SetDateFormat("MM.DD.YYYY")
>>
>> ?  DTOC(Today()) // Gives "04.28.2010"
>> ?  cFilter := "NYKALDAT" + " < " +  DTOC(Today()) // Gives "NYKALDAT <
>> 04.28.2010"
>>     uCB := &("{||" + cFilter + "}") // Codeblock
>> ?  SELF:oSFSub_Form1:Server:SetFilter(uCB ,cFilter) // Gives .T.
>>     SELF:oSFSub_Form1:Server:GoTop()
>>
>>     DO WHILE !SELF:oSFSub_Form1:Server:EOF
>> ?     SELF:oSFSub_Form1:Server:Recno // Show both records! Should only
>> show Post 2.
>>        SELF:oSFSub_Form1:Server:Skip()
>>     ENDDO
>>
>> Can somebody enlighten me? If I test with a numeric field it works.
>>
>> Stefan L
>
> Thanks Stephen,
> Worked like a charm.
> Stefan
>

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Setfilter and date "akaralis@otenet.gr" <blyxo1@gmail.com> - 2015-02-07 19:38 -0800
  Re: Setfilter and date Martin <spam@spam.spam> - 2015-02-09 10:34 +0000

csiph-web