Wednesday, December 3, 2008

Index hint


This is an optional parameter to help you optimize performance. 
Here's an example: 
static void InventDimJoinTest(Args _args) 
    SalesLine       salesLine; 
    InventDim       inventDim; 
    InventDim       inventDimCriteria; 
    InventDimParm   inventDimParm; 
    ; 
    InventDimCriteria.InventLocationId = 'Main'; 
    InventDimCriteria.wMSLocationId    = 'IN-1'; 
    InventDimCriteria.configId         = 'Red'; 
    inventDimParm.clear(); 
    inventDimParm.InventLocationIdFlag = NoYes::Yes; 
    inventDimParm.wmsLocationIdFlag    = NoYes::No; 
    inventDimParm.ConfigIdFlag         = NoYes::Yes; 
    while select salesLine 
        #InventDimJoin(salesLine.inventDimId, InventDim, inventDimCriteria, InventDimParm, dimIdx) 
    { 
        print strfmt("%1 %2 %3 %4 %5",salesLine.InventDimId, salesLine.SalesId, salesLine.ItemId, 
                     inventDim.InventLocationId, salesLine.inventDim().InventLocationId); 
    } 
    pause; 
The job finds all salesLines for the ‘Main’ warehouse and configuration ‘Red’. The location doesn’t matter, since it’s inventDimParm flag is turned off (additional dimensions like batch, serial etc.wouldn’t make a difference either, clear() takes care of that). 

Note that %4 prints the inventDim.inventLocationId. I just put that in there to make the point that it will always be blank. 

dimIdx is the optional parameter. It’s an index defined on the InventDim table. You will notice in the output the result is sorted by inventDimId. 

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...