Query with dates in

Frank Warmerdam fwarmerdam at GMAIL.COM
Mon Feb 28 15:40:53 EST 2005


On Mon, 28 Feb 2005 21:30:53 +0100, Roberto Bianconi
<roberto.bianconi at gmail.com> wrote:
> Hi,
>
> I have a shp file where data in the dbf associated are rows like this
> (field names in first row):
>
> CODE, BEGIN, END, VALUE
> A1, 2002-10-03T09:30:00, 2002-10-04T09:30:00, 60.
> A2, 2002-10-03T09:30:00, 2002-10-05T09:30:00, 60.
>
> Everything works if I just retrieve CODEs with:
>
> CLASS
>           SYMBOL "cross"
>           EXPRESSION ([VALUE] > 50. and [VALUE] <= 75.)
>           COLOR  70 255   0
>           OUTLINECOLOR 0 0 0
>        END
>
> However, if I query on dates too, then nothing is retrieved:
>
> CLASS
>           SYMBOL "cross"
>           EXPRESSION ([VALUE] > 50. and [VALUE] <= 75. and [BEGIN] <
> '2002-10-06T18:00:00')
>           COLOR  70 255   0
>           OUTLINECOLOR 0 0 0
>        END
>
> I've also tried the '2002-10-06 09:30' format, but no way...

Roberto,

Steve would know better, but aren't expressions just evaluated as simple
arithmetic comparisons when you use < or >?  Wouldn't
'2002-10-06T18:00:00' just evaluate to the number 2002? In
which case only records from before 2002 would be returned.

If you want smart date handling I think you need to accomplish
it somehow else.   I could be wrong about the issue of course.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list