Filtering in the form based on month


I am designin a form with different tables where the values filters based on the date provided by the user i.e from date and to date at run time. The issue is, for a particular value i want the value to be filtered based on the month provided in the date by the user for a particular table. How do I go on with this? Can anyone help me pls…

Thanks in advance…

Can you be more clear with ex or screenshot of your form?

Ya sure…

Actually I want the values from the Employee table where date option in it is the “Employment Date” which specifies the joinin date of the employee.

Example, an employee A joined the company on 17-01-2009 and employee B joined on 24-01-2011. With this in the form I wanted to know the no. of employees joined in the month of january. I run the form based on the date given by the user i.e the fromdate n the todate.

So you are running the form from another form which has fromdate and enddate given by user?

What did you try as of now?

Ya… the form runs from the date given by the user. Following is the code written for a different count value from sales header table…

recSH.SETFILTER(recSH.“Document Type”,‘Order’);
recSH.SETFILTER(recSH.“Order Date”,’>=%1&<=%2’,FromDate,ToDate);
SHCount := recSH.COUNT;

This gives the count of records, suppose for the date range 01-01-12 to 10-01-12 which we give. But in case of Employees, as i said I wanted to know the no. of employees joined in the month of january. But v give the full date in the date range, how can I make it filter only on month?

You said user will give startdate and enddate,right?

then the below code also should work if user enters startdate and enddate

Startdate := 010112D;
Enddate := 310112D;
Employee.SETFILTER(“Employment Date”,’>=%1 & <=%2’,Startdate,Enddate);

or user selects only month?

What exactly you mean by full date in date range? and why do you need month here?

You may have to first filter the set ,loop through them then check for the condition. something like this,

Filter table based on start and end date

IF findset then


CASE DATE2DMY(Employmentdate, 2)

1 : TotalinJan+=1

until last record

Hope this helps



Actually, I wanted to find out birthdays of the employee for the particular month, for that month is needed right, coz v cannot give the “Employment Date” of the Employee table while v run the form as the thr are many other values which works on the date provided by the user.

wow great…

what i understood is you are hiding your requirement…

look at your first post,second …and last…

but for Birth date, you can try something like this

Startdate := 01121963D;
Employee.SETFILTER(“Birth Date”,’>=%1 & <=%2’,CALCDATE(’<-CM>’,Startdate),CALCDATE(’’,Startdate));

Hey pls dont think otherwise, therez nothin to hide… i jus thought I was explainable enough in ma fisrt n second post n later wen u asked more, explained in detail dats it… Will try with what you have provided and check…


Dont I need to specify the end date??

If you want to know the Birth days of current month then no need of start date also…

you can use WORKDATE…

If you want to know any of the months then better give an option to select Month…

If you want to calculate based on a date then one date is enough…