Entering the No of months, Automatically date should display in End date

HI All

I have an requirement like

  1. User will enter the Date Manually in the StartDate Field.

  2. After that he will enter the No of Months in Eff Months field.

  3. In Enddate filed should update automatically based on the start date.


Start date is assume Today :(i.e 05-03-2012)

Eff month is :3

End date should upadate as :16-06-2012(Automatically).

Can any one help me how to achive this functionality.6036.d11.JPG

You can use standard functions such as nextMth, nextQtr, nextYr etc.

You can also use calendar functionality for this purpose. Small code below -

static void testCalendar(Args _args)

WorkCalendarDate WorkCalendarDate;
int noOfDays;

while select WorkCalendarDate
if (year(WorkCalendarDate.TransDate) == 2012
&& mthOfYr(WorkCalendarDate.transDate) == 3)




info(strFmt(‘No of days in March 2012 is %1’, noOfDays));


I got the solution,

Form Methods

Transdate calcDate(TransDate _effDate,

int _months,

int _days)


int counter = 1;

int mm, dd, yy;

TransDate tmpDate;


tmpdate = _effdate;

while (counter <= _months)


_effDate = nextMth(_effDate);

Counter ++;


mm = mthofyr(_effdate);

yy = year(_effDate);

dd = dayofMth(tmpdate);

_effDate = mkdate(dd, mm, yy) + _days;

return (_effDate - 1);


in the FormDatasource-EffMonths field i have called my method.

TblName.Enddate = element.calcDate(TblName.StartDate,TblName.EffMonths,0);