AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 28.10.2006, 16:40   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
Dynamics AX Geek: #InventDimJoin
Источник: http://AxGeek.spaces.live.com/Blog/c...DB13!141.entry
==============
If you’ve developed anything in the supply chain area, you’ve most probably come across InventDimJoin. InvenDimJoin is a macro and it’s mostly used to narrow down search results for inventory transactions (inventTrans) or inventory postings (inventTransPost), but can be used on any table having a inventDimId field.  
 
The macro accepts four to five parameters
·         InventDimId
·         InventDim
·         InventDimCriteria
·         InventDimParm
·         Index hint (optional)
 
You must use it as a join with a select-statement (hence the name) and it returns no contents from inventDim. It is not an exist join, but doesn’t return any useful fields, so it probably should be an exist-join. Anyway, let’s take the parameters one by one:
 
InventDimId
This is the unique key to the inventory dimension table. This is where you supply the inventDimId field from the table you are joining.
 
InventDim
Any InventDim table buffer. This is the table buffer used in the joined select. The contents of the buffer has no influence on the select result set and resulting records will only have the tableId field filled (but that’s a constant anyway and already filled by just defining the buffer, so really you get nothing).
 
InventDimCriteria
This is also a inventDim buffer, but the contents of this one matters. Using this buffer, you define which dimensions you are looking for exactly (warehouse ‘Main’, location ‘IN-1’, batch ‘241105’ etc.).
 
InventDimParm
InventDimParm is a temporary table. A record basically consists of nothing but a number of flags to indicate which inventory dimensions are important and which ones can be disregarded. There is a *Flag field for every inventory dimension field. InventDimParm has a variety of methods to initialize these flags. An example would be initPhysicalInvent(). It clears all flags (=No) and sets only those flags to yes whose corresponding inventory dimension is a physical dimension (for the dimension group id you pass along as a parameter).
Consequently you provide InventDimJoin with a InventDimParm buffer. For all flags with value ‘No’ the contents of the corresponding inventDimParm field does not matter.
 
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.
dimIdxis the optional parameter. It’s an index defined on the InventDim table. You will notice in the output the result is sorted by inventDimId.
 
 




==============
Источник: http://AxGeek.spaces.live.com/Blog/c...DB13!141.entry
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Dynamics AX: Managing Your Supply Chain Using Microsoft Dynamics AX 2009 - Book Review Blog bot DAX Blogs 0 31.03.2009 23:06
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Inside Dynamics AX 4.0: Usage Scenarios Blog bot DAX Blogs 0 04.10.2007 05:15
Сергей Герасимов: Что нового в Microsoft Dynamics AX 4.0 Blog bot DAX Blogs 0 16.01.2007 11:00
Dynamics AX: Why Dynamics AX beats SAP Blog bot DAX Blogs 0 10.01.2007 23:15

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:36.