Hi guys,
my requirement is sum of amount in PurchReqLine <LineAmount> addto to in PurchReqTable so that i extended PurchReqTable then add my custom field 'Total amount'
i can write display method in this scenario and i want to maintain the record so that i wrote a OnmodifiedFeild below my code it is not working on it what did i mistake.
class PurchReqTable_EventHandler
{
///
///
///
///
///
[DataEventHandler(tableStr(PurchReqTable), DataEventType::ModifiedField)]
public static void PurchReqTable_onModifiedField(Common sender, DataEventArgs e)
{
ModifyFieldEventArgs me = e;
FieldId fieldId = me.parmFieldId();
PurchReqTable thisRecord = sender as PurchReqTable;
PurchReqLine line;
switch(fieldId)
{
case fieldNum(PurchReqTable, TotalAmount):
thisRecord.TotalAmount = (Select sum(LineAmount) from PurchReqLine
where PurchReqLine.PurchReqTable == thisRecord.RecId).LineAmount;
break;
}
}
///
///
///
///
///
[FormDataFieldEventHandler(formDataFieldStr(PurchReqTable, PurchReqTable, TotalAmount), FormDataFieldEventType::Modified)]
public static void TotalAmount_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
PurchReqTable ThisRecord = sender.datasource().cursor();
ThisRecord.modifiedField(fieldNum(PurchReqTable, TotalAmount));
}
}
Thanks