Performance issue in "Open Transaction Edit" form
SE has noticed a performance issue in “Open Transaction Edit” form (AP >> Vendor Details form >> "Open Transaction Editing") in AX 2009 SP1. Post our investigations, we see that much time is consumed sizing the grid columns. Implementing a customization on the VendOpenTrans form will significantly reduce the time needed to open the form. ON test results from our end , we saw an improvement from 60 seconds to 11 seconds post implementing this customization .
Please note that you can also utilize the customization on various other forms that pose the same impact in performance reasons. Below are details on how to work around this issue by making changes to the \forms\VendOpenTrans with some code snippets given below.
Pre requisite : Ensure to have KB 968397 installed on both the client & server. This KB is also included Ax 2009 SP1 Roll-up 2 and is available here
Code snippets :
\Forms\VendOpenTrans\Designs\Design\[Tab:TabControl]\[TabPage:OverviewTab]\[Grid:OverviewGrid]
Change the AutoDeclaration Property from No to Yes.
The code snippet below contains an addition of “overviewGrid.autoSizeColumns(false)” which was a kernel method that was introduced by the referenced KB 968397 fix.
\Forms\VendOpenTrans\init
(NOTE: This change can be applied to the CustOpenTrans form as well)
…
super();
overviewGrid.autoSizeColumns (false); //added line
switch (originator.TableId)
…
The Company info table is updated:
A new field is added called DataArea which uses extended data type “CompanyID. ” The following SQL Statement can be used to update the new field with the proper data:
UPDATE COMPANYINFO SET DATAAREA = DATAAREAID
Method initValue() has 1 line added to populate the new field when a new company record is created.
void initValue()
{
super();
this.dataArea = this.dataAreaId; //line added
this.LanguageId = new Session().interfaceLanguage();
}
Secondly the entire CustVendOpenTransBalances.initCustVendBalanceMst() method is re-written as follows:
/// <summary>
/// Initializes the posted customer or vendor balance in the monetary standard (MST) currency.
/// </summary>
/// <param name="_custVendAccount">
/// The customer or vendor account number that is used to initialize the balance.
/// </param>
/// <param name="_isCustomerAccount">
/// A Boolean value that indicates whether to initialize the posted customer balance or the vendor
/// balance.
/// </param>
protected void initCustVendBalanceMst(AccountNum _custVendAccount, boolean _isCustomerAccount)
{
DirPartyId custVendPartyId;
CustVendTrans custVendTrans;
CustTrans custTrans;
VendTrans vendTrans;
CustVendTable custVendTable;
CustTable custTable;
VendTable vendTable;
CurrencyCode transMstCurrency;
Amount transMstBalance;
CurrencyExchHelper currencyExchHelper;
CompanyInfo companyInfo;
changecompany(custVendCompany)
{
if (_isCustomerAccount)
{
custTable = CustTable::find(_custVendAccount);
custVendPartyId = custTable.PartyId;
custVendTrans = custTrans;
custVendTable = custTable;
}
else
{
vendTable = VendTable::find(_custVendAccount);
custVendPartyId = vendTable.PartyId;
custVendTrans = vendTrans;
custVendTable = vendTable;
}
}
// Initialize currency exchange helper
currencyExchHelper = CurrencyExchHelper::construct();
currencyExchHelper.parmCompany(displayCompany);
while select crossCompany:sharedServiceCompanies sum(AmountMst), CurrencyCode, AccountNum from custVendTrans
order by companyInfo.CurrencyCode asc
group by companyInfo.CurrencyCode, custVendTrans.AccountNum
join DataArea, CurrencyCode from companyInfo
where companyInfo.DataArea == custVendTrans.dataAreaId
exists join AccountNum, PartyId from custVendTable
where custVendTable.AccountNum == custVendTrans.AccountNum
&& custVendTable.PartyId == custVendPartyId
{
transMstCurrency = companyInfo.CurrencyCode;
transMstBalance = custVendTrans.AmountMST;
// Convert to the company currency of the display company using the system date and the display company exchange rate, if necessary
if (transMstCurrency != displayMstCurrency)
{
if (Currency::existByCompany(displayCompany, transMstCurrency))
{
// Calculate the balance from the transaction company if its currency exists in the display company.
currencyExchHelper.parmCurrency(transMstCurrency);
transMstBalance = currencyExchHelper.calculateAmountCurToMst(transMstBalance, true);
}
else
{
// Otherwise the balance from that company should not be added to the total.
transMstBalance = 0;
}
}
custVendBalanceMst += transMstBalance;
}
}
Comments
- Anonymous
October 20, 2014
open AOT find table VENDTRANSCASHDISC
create a new index...:
"ExampleIdx" (allow duplicates == no)
add these fields to the index...:
REFRECID,REFTABLEID,CASHDISCDATE, RECID, DATAAREAID, PARTITION
/Kenneth