Searching / Finding Dates

I’m at a loss.
I’ve read all I could find about searching dates both on-line and in the docs. Just can’t make this code work. Any pointers:

if ( globals.g_Fnts_cDate_1 ) {
	dateRequest += utils.dateFormat(globals.g_Fnts_cDate_1, 'dd-MM-yyyy');
	if ( globals.g_Fnts_cDate_2 ) {
		dateRequest += '...' + utils.dateFormat(globals.g_Fnts_cDate_2, 'dd-MM-yyyy');
	}
	dateRequest += '|dd-MM-yyyy';
}
else {
	if ( globals.g_Fnts_cDate_2 ) {
		dateRequest += '<=' + utils.dateFormat(globals.g_Fnts_cDate_2, 'dd-MM-yyyy');
		dateRequest += '|dd-MM-yyyy';
	}
}

Database: Firebird 1.5 - Current Official release
Servoy Developer
Version R2 2.2.5-build 337
Java version 1.5.0-b64 (Windows XP)

Txs,
Miguel

search find date

Hi Miguel,

Can you add a application.output(dateRequest); at the end of your code to see what is really used in your search request?

Hello Robert,

Thanks for giving a hand. I figured some stuff out but am still in trouble.
Here’s what I’ve learned (and where I’m in trouble):

Case 1 - Just adding criteria to the first date globals.g_Fnts_cDate_1 I get:

dateRequest = '06-06-2006|dd-MM-yyyy'

Doesn’t Work!
I need to add ‘#’ to the begining of the code to make it work!? :oops:

Case 2 - Adding criteria to begining and end date globals.g_Fnts_cDate_1 I get:

dateRequest = '06-06-2006...17-06-2006|dd-MM-yyyy'

Does work! Strangely there doesn’t seem to be any need for the ‘#’ here!

Case 3 - Adding criteira to the end date only:

dateRequest = '<= 06-06-2006|dd-MM-yyyy'

Doesn’t work for exact dates! I can’t figure out how to use the ‘#’ format character here!? I mean I have 6 records for 06-06-2006 (several different times) but I have 0 results!

Txs,
Miguel

Hi Miguel,

dateRequest = '<= 06-06-2006|dd-MM-yyyy'

Remove the space between the <= and the rest of the date. Then it works.

The rest sounds about right :)

Good morning Robert,

ROCLASI:

dateRequest = '<= 06-06-2006|dd-MM-yyyy'

Remove the space between the <= and the rest of the date. Then it works.

Unfortunately it doesn’t. Using ‘<’ or ‘<=’ with or without the space before the dateRequest, results in the request being completly ignored in the result set (other criteria survive and are honored).

I found this workable solution:

if ( globals.g_Fnts_cDate_2 ) {
    tempDate = globals.g_Fnts_cDate_2;		
    tempDate.setDate(tempDate.getDate()+1); // add one day
    var year = tempDate.getFullYear();
    var month = tempDate.getMonth()+1;
    var day = tempDate.getDate();
    dateRequest = '<' + day + '-' + month + '-' + year;
    dateRequest += '|dd-MM-yyyy';
}

In this snippet the equality operator still doesn’t work. This is why I add one to the day.

I wonder if this is a Firebird peculiarity!?
Do you know if anyone else is using Firebird with Servoy?
By the way you have experience with Postgre. Ever used it on windows?

Sorry for all the questions :D

Best,
Miguel

mjekl:
By the way you have experience with Postgre. Ever used it on windows?

Hi Miguel,

we are using postgres on Windows, Linux and Mac OS. Works really well on all platforms. Easy to install on Windows.

Incrediby fast on Mac OS (Intel) compared with Sybase which still runs under Rosetta.

Hi Miguel,

we are using postgres on Windows, Linux and Mac OS. Works really well on all platforms. Easy to install on Windows.

Incrediby fast on Mac OS (Intel) compared with Sybase which still runs under Rosetta.

Txs for the input Swingman. I’ll check it out for sure!

Best,
Miguel