Tuesday 19 July 2016

InventSum vs InventBatch relations in AX 2012

InventSum -> InventDim = InnerJoin
InventDim -> InventBatch = ExistsJoin 

static void inventSumQuery(Args _args)
{
    Query                   query;
    QueryRun                queryRun;
    QueryBuildDataSource    qbdsInventBatch,
                            qbdsInventDim,
                            qbdsInventSum;

    InventSum               inventSum;
   
    query = new query();
    //InventSum
    qbdsInventSum = query.addDataSource(tableNum(InventSum)); 
    //joins InventDim
    qbdsInventDim = qbdsInventSum.addDataSource(tableNum(InventDim));
    qbdsInventDim.relations(true);
    qbdsInventDim.joinMode(JoinMode::InnerJoin);
    //join InventBatch
    qbdsInventBatch = qbdsInventDim.addDataSource(tableNum(InventBatch));
    qbdsInventBatch.relations(true);
    qbdsInventBatch.joinMode(JoinMode::ExistsJoin);
    //item range   
    qbdsInventSum.addRange(fieldNum(InventSum, ItemId)).value("2664814");  

    queryrun = new QueryRun(query);

    while (queryRun.next())
    {
        queryRun.changed(tableNum(InventSum));
        {
            inventSum = queryRun.get(tableNum(InventSum));
            info(strFmt("ItemId - %1",inventSum.itemid));
        }
    }
}

Monday 25 April 2016

Error getting when totals clicked from PurchTableListpage in AX 2012 R3

Getting the below error while clicking the Totals button in the PurchTableListpage form
Navigation
USMF/Accounts payable/Common/Purchase orders/All purchase orders/View/Totals

The error occurs when we disable the fact-boxes (may be some performance reasons).
USMF/System administration/Area page/Setup/System/Client Performances option


This error related to the part list object when it try to get initialize when the fact-boxes are disabled in AX system.

This can be resolved by changing the if condition as

if(partList.getPartById(counter) && partList.getPartById(counter).name() == formStr(PurchTotalsSummaryPart))

The same fix was resolved by MS in CU 10 release.

Wednesday 17 February 2016

Caching property against table groups in Ax 2012

Uses the following caching property for the table groups,
Table Group Cache Lookup
 Parameter  EntireTable
 Group  Found
 Main  Found
 Transaction  NotInTTS
 WorksheetHeader  NotInTTS
 WorksheetLine  NotInTTS
 Framework  N/A
 Reference  Found
 Worksheet  NotInTTS
 TransactionHeader  NotInTTS
 TransactionLine  NotInTTS

By default table group property for the custom table Miscellaneous,  As per the standard, Custom tables should not use this group.

Reference link is attached
table caching property

Note : Wrong caching leads to unnecessary database calls.






Calculate ledger balance by dimension set in X++ in AX2012/Dynamics 365 FO

There are a variety of ways users can view balances in the general ledger. Some of the most common options are: 1. Trial balance 2. Financia...