1

In InventJournalName table there is JournalNameId column and JournalType.

Using:

InventJournalNameId inventJournalName;

inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);

I am indeed able to get a JournalNameId of type Movement from the InventJournalName table. To be more concise, the first one.

With the debugger I got to this point :

public static InventParameters find(boolean _forupdate = false)
{
   InventParameters parameter;

   if (_forupdate)
   {
      parameter.selectForUpdate(_forupdate);
   }

   select firstonly parameter
      index Key
      where parameter.Key == 0;

   if (!parameter && !parameter.isTmp())
   {
      Company::createParameter(parameter);
      PrintMgmt::createDefaultData(PrintMgmtHierarchyType::Invent);
   }

  return parameter;
}

To be honest, I can't really understand what's the role of the InventParameters table.

It's clear that:

select firstonly parameter
   index Key
   where parameter.Key == 0;

will return what I need but what's the mechanism behind the scenes?

Is there any difference between the above way and:

select firstOnly inventJournalName
where inventJournalName.JournalType ==
InventJournalType::Movement;
4

1 回答 1

3

你有一个参数的原因是因为你应该能够定义一个标准的期刊名称,而不管表中有多少期刊名称InventJournalName

对于同一期刊类型,您可以在该表中有多个期刊名称,只要它们的名称不同。

如果您有 2 个移动类型名称,则此代码

select firstOnly inventJournalName
where inventJournalName.JournalType ==
InventJournalType::Movement;

基本上会返回一个随机记录(如果没有顺序,则不能保证哪个是第一个)。

另一方面,这

select firstonly parameter
   index Key
   where parameter.Key == 0;

将返回参数表中的内容并且是确定性的。

如果你想知道为什么where parameter.key == 0。这是因为 AX 的缓存机制是如何工作的。所有参数表均设置为,entiretablecache=yes但是只有在主键上选择时才从缓存中检索记录。

于 2016-01-05T15:23:27.817 回答