Find records through Date Ranges

Hello,
I am trying to display records by date range and am having trouble, below
is the method I am using, I would like to use the calander date picker to populate both the globals with data??, I am very sure there is someone who has done this, and I would really appreciate some assistance please.

Regards

Phil R

//set date range for display
controller.find()
invoice_date = 'globals.searchInvStartD...globals.searchInvEndD'
controller.search(true,false)
//reset display list to show all records
globals.searchCompanyname = ""

try this:

//set date range for display
controller.find()
invoice_date = globals.searchInvStartD + '...' + globals.searchInvEndD
controller.search(true,false)
//reset display list to show all records
globals.searchCompanyname = "

or another one:

//set date range for display
controller.find()
invoice_date = utils.dateFormat(globals.searchInvStartD,'dd-MM-yyyy HH:mm') + '...' + utils.dateFormat(globals.searchInvEndD,'dd-MM-yyyy HH:mm')
controller.search(true,false)
//reset display list to show all records
globals.searchCompanyname = "

Many Thanks for you reply, but I am still having problems I enabled the debugger and it seems that the varibles are not being populated with data, well they are not being reported under varibles in the debugger window. Is the below code OK??

//set date range for display
controller.find()
[b]invoice_date = globals.searchInvStartD + '...' + globals.searchInvEndD[/b]
controller.search(true,false)
//reset display list to show all records
//globals.searchCompanyname = ""

prj311:
Many Thanks for you reply, but I am still having problems I enabled the debugger and it seems that the varibles are not being populated with data, well they are not being reported under varibles in the debugger window. Is the below code OK??

//set date range for display

controller.find()
invoice_date = globals.searchInvStartD + ‘…’ + globals.searchInvEndD
controller.search(true,false)
//reset display list to show all records
//globals.searchCompanyname = “”

first of all, a global is not a variable!

a global is a value that is the same over the whole solution
a variable is a value that is the same in one method!

what is ???

uhm…

of course a global is a variable. It is a variable (meaning you can change the content at anytime) that is addresable throughout the whole applications. Global means placed on the globals variable stack as opposed to local variables whos scope is limited to the method they are created in.

sorry could not resist. 8)

Hi,
Many thanks for your help I have progressed a little but I’m still having problems,
please see the following code.

controller.find()
var searchResult = utils.dateFormat(globals.searchInvStartD,'dd-MM-yyyy') + '...' + utils.dateFormat(globals.searchInvEndD,'dd-MM-yyyy')
invoice_date = searchResult;
//controller.search();

I have intensionally commented out the controller.search() function just to see what data is returned to feild invoice_date.
After chosing the search dates I get the following in the invoice_date feild

01-03-2006…28-03-2006

which should work, but it does not.

If I go into find mode manually and type the above manually it works, also if I remove the preceeding zeros it works eg

1-3-2006…28-3-2006

What is going on???

Please Help

PR[/code]

Servoy Help (Content > Getting Started > Finding Data > Finding Dates and Time) states the following:

Finding a range of dates To search for a range of dates, be sure to include the display value; a pipe character |; and the edit value as part of your search criteria.

Example: 

//performs a find for a date range in startDateTime
controller.find();
startDateTime = '1-1-2004...1-30-2004|MM-dd-yyyy';
controller.search();

Hope this helps.

Thanks for the reply,
but if I wanted to replace the hard coded dates in the example with globals, how would you go about that??

Concatenate the strings like you did but add the piped format to it.
It’s only that part you are missing so far.