Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Sunday, January 12, 2014

Code for exchange rates in Dynamic AX 2012

Hi,

currency::find(CurrencyCode).findExchRate(today()); in Dynamic ax 2009 following code is for Dynamic AX 2012

    static ExchRate exchRateFind(CurrencyCode _currencyCode = '')
{
    ExchangeRateType    ExchangeRateType;
   // ExchangeRate        ExchangeRate;
    ExchangeRateCurrencyPair    ExchangeRateCurrencyPair;
    ExchRate    ret;
    ExchangeRateHelper exchangeRateHelper;
    TransDate transactiondate;
    CurrencyExchangeRate exchangeRate1;
    CurrencyExchangeRate exchangeRate;
    ;
    exchangeRateHelper = ExchangeRateHelper::newExchangeDate(Ledger::current(), _currencyCode, systemDateGet());
    exchangeRate1 = exchangeRateHelper.getExchangeRate1();
    exchangeRate = exchangeRateHelper.displayStoredExchangeRate(exchangeRate1);//Ledger::find(Ledger::current()).DefaultExchangeRateType
    return exchangeRate;
}

Regards,

Monday, December 30, 2013

An unbalanced X++ TTSBegin/TTSCommit pair has been detected .Cause of this include (a) too many/few TTSBegin or TTS Commit - Dynamic AX

Hi,

An unbalanced X++ TTSBegin/TTSCommit pair has been detected .Cause of this include (a) too many/few TTSBegin or TTS Commit . The current TTS level is '1'

Just run this job and go head with your work above error will not come.

static void AlfasithResetTTS(Args _args)
{
while (appl.ttsLevel() > 0)
ttsAbort;
}

Enjoy

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...