One more date range search problem

Hi,
I apologize cause i know this has been asked many times but i just cant solve it.
Im trying to use a find() on a date range, i clearly want all records whose date is between 2 other dates.
heres my code

databaseManager.setAutoSave(true)
forms.pedidos.controller.find()

var Searchdate = new Date()
Searchdate = utils.dateFormat(globals.firstDate,'yyyy-MM-dd')+...+utils.dateFormat(globals.lastDate,'yyyy-MM-dd')

forms.pedidos.date = Searchdate +'| yyyy-MM-dd';

var found = forms.pedidos.controller.search()
databaseManager.setAutoSave(false)

And well its finding every record on the table.
Any ideas??

Thanks in advance

Initialize the variable “Searchdate” as a string.

still not working…

Try this:

if ( forms.pedidos.controller.find() ) {
    
    // 3 periods should be between quotes.
    var Searchdate = utils.dateFormat(globals.firstDate,'yyyy-MM-dd')+"..."+utils.dateFormat(globals.lastDate,'yyyy-MM-dd')
    
    // If I remember correctly when using a mask in search you need to use the hash sign at the beginning
    forms.pedidos.date = "#" + Searchdate +'| yyyy-MM-dd';
    
    var found = forms.pedidos.controller.search()
}

Still finding all records…
Im using servoy 5.0.0 and sybase central 11.0.1
I also tryied without formatting the dates and i get the same results.

could the quotes be affecting someting??
i mean using " " or ’ ’ ?

nromeou:
could the quotes be affecting someting??
i mean using " " or ’ ’ ?

That shouldn’t make a difference.

Perhaps the extra space after the pipe character is the issue ?

No… its not that :?

I guess I have to really test this.
What version of Servoy is this ?

Servoy
Version: 5.0.0 - build 859

The only thing that comes to my mind is that perhaps the format that the DB stores the date value is not the same im using to compare.
What i dont get is that if i do a query on the DB it returns values with yyyy-MM-dd format but if i do an application.output of the date field it returns somenthing like Fri 23 Dec 00:00:0000 GMT 2009 (or something like that).

And what annoys me is that if i search for an exact date (not a range) it works perfectly fine.

nromeou:
if i do an application.output of the date field it returns somenthing like Fri 23 Dec 00:00:0000 GMT 2009 (or something like that).

When you do that you are actually looking at a Java Date object…so yes the formatting is different.
But the locale/formatting shouldn’t make a difference. Let me do some testing.

nromeou,

It is the extra space after pipe symbol, remove it and it will work

forms.pedidos.date = "#" + Searchdate +'|yyyy-MM-dd';

Rob

Yep, I tested it and like Rob said it’s the space.
Also the # is required when you use a mask in your search (my memory didn’t fail me on this one).

Thanks guys! :D
Seems that when i tryied that before i had something else wrong