Date field in find mode

Hello

In the date field I use the mask ‘dd-MM-yyyy|mask’ so that the user does not have to type ‘-’ between date and month and year.

The problem is in find mode this mask not work, and the search is not correct

Any idea?

Thanks

Servoy 6.1.3

Hello Juan

Although the below filter is syntax is deprecated it may help you. This syntax filters between two dates
The # ignores the minutes and seconds
variable vFromDate is form variable usually selected form date picker, but is in similar format.

if(controller.find() ) {
hedstart = ‘#’ + utils.dateFormat(vFromDate,‘dd-MM-yyyy’) + ’ … ’ + utils.dateFormat(vToDate,‘dd-MM-yyyy’ ) + ‘|dd-MM-yyyy’
controller.search()

Hi,

I too tried the solution you provide but with no luck. Is there any alternative method to specify a date range when performing a find on a foundset? I’m really starting to despair of doing this!

Hi ,

In the find mode we can give condition for search for date field , like this ,

if(fs.find()) {

data_field = v_user_enter_date (or) v_date_picker + ‘|ddMMyyyy’ ;

fs.search()
}

Hope this will helpful to you . Use this for testing user entry is a valid date ,
(/^\d{1,2}\d{1,2}\d{4}...\d{1,2}\d{1,2}\d{4}$/.test( v_user_enter_date) && (utils.stringPatternCount( v_user_enter_date, ‘.’)==3) )|| (/^\d{1,2}\d{1,2}\d{4}$/.test( v_user_enter_date))

Thanks
Chaitanya s

Might try converting the date to a number, like 20130402. Then using those to do your search.

Mark Crichton:
Hello Juan

Although the below filter is syntax is deprecated it may help you. This syntax filters between two dates
The # ignores the minutes and seconds
variable vFromDate is form variable usually selected form date picker, but is in similar format.

if(controller.find() ) {
hedstart = ‘#’ + utils.dateFormat(vFromDate,‘dd-MM-yyyy’) + ’ … ’ + utils.dateFormat(vToDate,‘dd-MM-yyyy’ ) + ‘|dd-MM-yyyy’
controller.search()

Hi Juan

I have tested the above code and it works fine. I believe you might be missing something so I have attached a sample solution. You can import it with sample data to check.

Hope this helps.

Regards
Lopamudra
http://www.mindfiresolutions.com/

filterByDate.servoy (5.25 KB)