Hi,
I am trying to Bring Exchange Rate for the Transaction through Computed Column in View,
Code of the Computed Method is
static client server str getTransactionExchangeRate()
{
ExchRate exchRate;
changecompany(curExt())
{
//exchRate = ExchangeRateHelper::getExchangeRate1_Static(Ledger::current(),
//SysComputedColumn::returnField(tableStr(TestCommissionSaleslineView),identifierStr(SalesLine),fieldStr(SalesLine,CurrencyCode)),
//DateTimeUtil::date(str2Datetime(SysComputedColumn::returnField(tableStr(TestCommissionSaleslineView),identifierStr(SalesLine),fieldStr(SalesLine,CreatedDateTime)),123)));
exchRate = ExchangeRateHelper::exchRate(SysComputedColumn::returnField(tableStr(TestCommissionSaleslineView),identifierStr(SalesLine),fieldStr(SalesLine,CurrencyCode)),
DateTimeUtil::date(str2Datetime(SysComputedColumn::returnField(tableStr(TestCommissionSaleslineView),identifierStr(SalesLine),fieldStr(SalesLine,CreatedDateTime)),321)));
}
return strFmt('%1',exchRate);
}
I tried the GetExchangeRate1_Static which was throwing a different error then i tried the normal one.
Am i missing anything.
I facing this error why doing Synchronization of View
Infolog diagnostic message: Infolog diagnostic message: 'The accounting currency has not been specified for ledger dat, and is required to retrieve exchange rate information.' on category 'Error'.
Unexpected error occurred while execute computed column method: Unexpected error occurred while execute computed column method: getTransactionExchangeRate on view/ data entity TestCommissionSaleslineView Microsoft.Dynamics.Ax.Xpp.ErrorException
at Dynamics.AX.Application.ExchangeRateCalculation.`handleError(String _error, String _faultCode) in xppSource://Source/Currency\AxClass_ExchangeRateCalculation.xpp:line 676
at Dynamics.AX.Application.ExchangeRateCalculation.handleError(String _error, String _faultCode)
at Dynamics.AX.Application.ExchangeRateHelper.`defaultAndValidateToCurrency() in xppSource://Source/Ledger\AxClass_ExchangeRateHelper.xpp:line 54
at Dynamics.AX.Application.ExchangeRateHelper.defaultAndValidateToCurrency()
at Dynamics.AX.Application.ExchangeRateCalculation.`getExchangeRate1() in xppSource://Source/Currency\AxClass_ExchangeRateCalculation.xpp:line 353
at Dynamics.AX.Application.ExchangeRateCalculation.getExchangeRate1()
at Dynamics.AX.Application.ExchangeRateHelper.`exchRate(String _currencyCode, Date _exchRateDate, UnknownNoYes _exchRatesTriangulation, Boolean _showerror, NoYes _governmentExchRate, Boolean @_exchRateDate_IsDefaultSet, Boolean @_exchRatesTriangulation_IsDefaultSet, Boolean @_showerror_IsDefaultSet, Boolean @_governmentExchRate_IsDefaultSet) in xppSource://Source/Ledger\AxClass_ExchangeRateHelper.xpp:line 385
at Dynamics.AX.Application.ExchangeRateHelper.exchRate(String _currencyCode, Date _exchRateDate, UnknownNoYes _exchRatesTriangulation, Boolean _showerror, NoYes _governmentExchRate, Boolean @_exchRateDate_IsDefaultSet, Boolean @_exchRatesTriangulation_IsDefaultSet, Boolean @_showerror_IsDefaultSet, Boolean @_governmentExchRate_IsDefaultSet)
at Dynamics.AX.Application.ExchangeRateHelper.exchRate(String _currencyCode, Date _exchRateDate)
at Dynamics.AX.Application.TestCommissionSaleslineView.`getTransactionExchangeRate() in xppSource://Source/Test\AxView_testCommissionSaleslineView.xpp:line 35
at Dynamics.AX.Application.TestCommissionSaleslineView.getTransactionExchangeRate()
at TestCommissionSaleslineView::getTransactionExchangeRate(Object[] , Boolean& )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
at Microsoft.Dynamics.AX.DataAccess.StatementGenerator.UnboundField.get_ComputedValue()
Database synchronization failed.
One more doubt i have is Why Computed Column it always expects the static method to return string. (str) then what is the user other type of ComputeColumsn where as the returns types should match
Any Advise and help, thanks
Dilliraj