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


Groups > comp.lang.clipper.visual-objects > #7726 > unrolled thread

Re: Setfilter and date

Started by"akaralis@otenet.gr" <blyxo1@gmail.com>
First post2015-02-07 19:38 -0800
Last post2015-02-09 10:34 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.clipper.visual-objects

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#7726 — Re: Setfilter and date

From"akaralis@otenet.gr" <blyxo1@gmail.com>
Date2015-02-07 19:38 -0800
SubjectRe: Setfilter and date
Message-ID<da7b356d-6066-4463-bb42-1591425fdf53@googlegroups.com>
Τη Τετάρτη, 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

[toc] | [next] | [standalone]


#7728

FromMartin <spam@spam.spam>
Date2015-02-09 10:34 +0000
Message-ID<mba2dm$ae4$1@dont-email.me>
In reply to#7726
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
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web