I have 2 fields "Ending Date" (Date type) and "Required Arrival Day" (Integer type)
Now, I want to change "Required Arrival Day" to Date Type base on value of "Ending Date" and display on Page
I wrote a function below:
CreateRequiredArrivalDay("Required Arrival Day" : Integer;"Ending Date" : Date) RequiredArrivalDayReal : Date
//BEGIN
IF "Required Arrival Day" >= DATE2DMY("Ending Date",1) THEN
ActiveMonth := DMY2DATE(1,DATE2DMY("Ending Date",2),DATE2DMY("Ending Date",3))
ELSE
ActiveMonth := DMY2DATE(1,DATE2DMY(CALCDATE('1M',"Ending Date"),2),DATE2DMY(CALCDATE('1M',"Ending Date"),3));
CASE DATE2DMY(CALCDATE('CM',ActiveMonth),1) OF
28:
IF "Required Arrival Day" <= 28 THEN
RequiredArrivalDayReal := DMY2DATE("Required Arrival Day",DATE2DMY(ActiveMonth,2),DATE2DMY(ActiveMonth,3))
ELSE
RequiredArrivalDayReal := CALCDATE('CM',ActiveMonth);
29:
IF "Required Arrival Day" <= 29 THEN
RequiredArrivalDayReal := DMY2DATE("Required Arrival Day",DATE2DMY(ActiveMonth,2),DATE2DMY(ActiveMonth,3))
ELSE
RequiredArrivalDayReal := CALCDATE('CM',ActiveMonth);
30:
IF "Required Arrival Day" <= 30 THEN
RequiredArrivalDayReal := DMY2DATE("Required Arrival Day",DATE2DMY(ActiveMonth,2),DATE2DMY(ActiveMonth,3))
ELSE
RequiredArrivalDayReal := CALCDATE('CM',ActiveMonth);
31:
RequiredArrivalDayReal := CALCDATE('CM',ActiveMonth);
END;
EXIT(RequiredArrivalDayReal);
//END
How to use this function into page or table to display result that i want?
Thanks!
*This post is locked for comments