We can create extension for class but can use/call only Public Members/Methods. Private and Protected can not be accessed from Extension Class.
Added new field TstField in MainAccount Table using extension.
Would like to show newly added field on Trail balance Form/Report.
Added new field TstField in LedgerTrialBalanceTmp Table using extension.
/// <summary>
/// Extension Class
for LedgerTrialBalanceDP
/// </summary>[ExtensionOf(classStr(LedgerTrialBalanceDP))]
final class
HNWLedgerTrialBalanceDP_Extension
{
protected void new()
{
}
///
Updating new field in <c>LedgerTrialBalanceTmp</c> Table
///
</summary>
public void UpdateTstField()
{
MainAccount mainAccount;
DimensionAttributeValueCombination ledgerDimension;
LedgerTrialBalanceTmp ledgerTrialBalanceTmp;
ledgerTrialBalanceTmp = this.getLedgerTrialBalanceTmp();
update_recordset ledgerTrialBalanceTmp
settingTstField = mainAccount.TstField
join mainAccount
exists join ledgerDimension where
ledgerDimension.MainAccount == mainAccount.RecId &&
ledgerDimension.RecId == ledgerTrialBalanceTmp.LedgerDimension;
this.setTrialBalanceTmpTable(ledgerTrialBalanceTmp);
}
}
Create postEventHandler for processReport method in LedgerTrialBalanceDP Class
and call our newly created method in Extension Class of LedgerTrialBalanceDP
public class HNWLedgerTrailBalanceHandlersExt
{
[PostHandlerFor(classStr(LedgerTrialBalanceDP), methodStr(LedgerTrialBalanceDP, processReport))]and call our newly created method in Extension Class of LedgerTrialBalanceDP
public class HNWLedgerTrailBalanceHandlersExt
{
public static void
LedgerTrialBalanceDP_Post_processReport(XppPrePostArgs args)
{
LedgerTrialBalanceDP ledgerTrialBalanceDP
= args.getThis();ledgerTrialBalanceDP.UpdateTstField();
}
}