Need to calculate return date automatically

I done this using modified field in line table by following code:

case fieldnum(AX_TransactionLine,TransDate):
select maxof(tobereturndate) from axtl where axtl.Trans_Id==this.Trans_Id;
update_recordset axt2 setting tobereturndate = axtl.ToBereturnDate where axt2.Trans_Id==this.Trans_Id;
break;

Thank you all for helping…