Button method for searching by month

With a simple table that has a date column and a few text columns what is the best way in Servoy to create a list that will allow the user to click one of a group of buttons on the header named Jan, Feb, Mar, etc. that will search for all records with a corresponding month in the date column? A sample button method that can achieve this is all I need.

here is how I do it:

create a global field: maanden (months)
create a global field: jaar (year)

create a valuelist: vl_maanden:
All|0
Jan|1
Feb|2
Maa|3
Apr|4
Mei|5
Jun|6
Jul|7
Aug|8
Sep|9
Okt|10
Nov|11
Dec|12
and attach it to global: maanden and make the field: RADIOS

create a valuelist: vl_jaar

2003
2004
2005
2006
2007
2008
2009
2010

and attach it to global: jaar and make the field: combobox

here is the method:

var month = globals.maanden
var year = globals.jaar
var endOfMonth = new Array('31-01','28-02','31-03','30-04','31-05','30-06','31-07','31-08','30-09','31-10','30-11','31-12');

if (  ( (year % 4 == 0) && (year % 100 != 0) ) || (year % 400 == 0)   ) {endOfMonth[1] = "29-02"};

controller.find();
if(globals.maanden == "0" && globals.jaar != "")
{
	offertedatum = '01-01-'+year+'...31-12-'+year+'|dd-MM-yyyy'
}
if(globals.maanden != "0" && globals.jaar != "")
{
	offertedatum = '01-'+month+'-'+year+'...'+endOfMonth[month-1]+'-'+year+'|dd-MM-yyyy'
}
controller.search()

Hope this helps

Thank you very much. That was exactly what I needed! :D

An alternative to the method suggested by the esteemed HJK.

Date field [dated]
Calculated integer field [yyyymm] = return (dated.getFullYear() * 100) + (dated.getMonth() + 1);

This converts the [dated] field into 200312, 200401, 200402 etc etc.

Month selection field [SelectDate] based on value-list using [yyyymm] field.

If users not comfortable with choosing 200402 for Feb 2004 you could add another calculated field to display Month_Year in text.

Hope this helps

Graham Greensall