RE: Display running balance in standers form
Hi Shubham Gupta,
Now I understand what you mean by running balance.
Here is a sample code:
[SysClientCacheDataMethodAttribute(true)]
public display Amount runningBalance()
{
CustTrans custTrans;
select sum(AmountCur) from custTrans
where custTrans.AccountNum == this.AccountNum
and custTrans.TransDate <= this.TransDate
and custTrans.Voucher <= this.Voucher
and custTrans.BillofExchangeStatus <= this.BillofExchangeStatus
and custTrans.RecId <= this.RecId;
return custTrans.AmountCur;
}
Some important things to consider:
1) This operation can be really slow, because you will need to perform a select sum for each line based on the past lines.
2) Create the display method on the table and use the SysClientCacheDataMethodAttribute.
3) In the sample code, I used the fields from the AccountDateIdx index to sum the records, because this is the index used to sort records on the CustTrans form.
4) Filtering and sorting on the form level won't reflect on the display field since the calculation is done on the table level. If the user applies any filters to the form or change the sort order, the information on this field will then be useless and misleading.