My goal is to add the value of the method CustTrans.custPaymManAmountMST in the report.
Here is the method:
static server AmountMST openAmountMST(CustAccount _custAccount, CurrencyCode _currencyCode = '*')
{
CustTrans custTrans;
CustPaymManTrans custPaymManTrans;
;
select sum(AmountMST) from custTrans
where custTrans.AccountNum == _custAccount &&
custTrans.CurrencyCode like _currencyCode
exists join custPaymManTrans
where custPaymManTrans.RefRecId == custTrans.RecId;
return -custTrans.AmountMST;
}
Upon populating the temp table custAgingReportTmp, I noticed that there's an AccountNum field. So there's no problem of just joining the table CustTrans to the statement.
insert_recordset custAgingReportTmp
(fields here)
select
(fields here)
from tmpAccountSum
join SortOrder
from custVendTransAging
where tmpAccountSum.AccountNum == custVendTransAging.AccountNum
join AmountMST
from custTrans
where tmpAccountSum.AccountNum == custTrans.AccountNum
I added the custTrans and I successfully displayed it in the report. However, the AmountMST I need to get, should check if it exists in this table another table (as seen on the custPaymManAmountMST method) which is:
exists join custPaymManTrans where custPaymManTrans.RefRecId == custTrans.RecId;
but when I add this exists join syntax above, I get 0 returns.
Is there anyway I can apply the exists join to that I can get the correct AmountMST? or my approach is incorrect?
*This post is locked for comments
I have the same question (0)