searching dates in methods

Hi

I am writing a method that will search for all dates less than a global search date with the following code:

//sets var for find
var date = “<” + utils.dateFormat(globals.g_search_datestart, “dd-MM-yyyy”);

forms.report_inv_shelflife.controller.find();

if (globals.g_search_datestart)
{
forms.report_inv_shelflife.batch_shelffinish = date;
}

forms.report_inv_shelflife.controller.search();

running this from a method doesn’t work properly and shows all records. when i perform the search manually with, eg. <01-01-2006 in the search field i get the correct result.

If i watch the variables in the method and step through the method the value appears perfectly as eg. <01-01-2006 in the field in find mode but the search does not execute properly.

Obviously doing something wrong but the formatting appears right?

Would appreciate any help

Woops!

added the " + | dd-MM-yyyy" as in:

//sets var for find
var date = “<” + utils.dateFormat(globals.g_search_datestart, “dd-MM-yyyy”);

forms.report_inv_shelflife.controller.find();

if (globals.g_search_datestart)
{
forms.report_inv_shelflife.batch_shelffinish = date + “| dd-MM-yyyy”;
}

in the method, works fine now.