如何将XML中的字符串值插入AX中的偏移帐户分段文本框?

时间:2017-04-17 06:43:14

标签: axapta dynamics-ax-2012

我正在尝试将值插入偏移帐户类型

的细分文本框中

enter image description here
我将放置字符串,我只会为主要帐户和成本中心放置值,其余的将不适用(零)

offsetcon = [lineItemsNode.selectSingleNode("GLAccount").text(), "00","00",lineItemsNode.selectSingleNode("CostCenter").text(),"0000","000","000","00000","000","00"];
            trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetcon));

我已经尝试了上面的代码,但我得到了错误

  

主要帐户00不存在

据我所知,主帐户是容器中的第一个索引,错误说不是。

1 个答案:

答案 0 :(得分:2)

根据我发现的......

偏移帐户具有分段值,如果您要将字符串/文本传递给它,则必须将其放在容器中。

offsetContainer =[ MainAccount, MainAccount, *Number of Dimensions*, *Name of the Dimension*, *Value of the Dimension*, ... ]; 

... - 意味着可以添加更多内容。 忽略星号()。*

前两个部分是 MainAccount (我真的不确定第一部分,如果我错了请纠正我。但我已经研究过它,它的价值不同于第二个,在我的情况下,我使用与第二个段相同的值,它对我有效。),然后下一个是维数。这是您要在MainAccountId之后放置值的细分数,然后维度名称是细分的名称。最后,维度的值这是您要分配给刚刚命名的维度的值。

所以这是一个片段的例子。

Here's an example of a segment

以下是您对容器进行编码的方法:

offsetContainer = [ 1101006, 
                    1101006, 
                    5, 
                    'BudORProject',
                    '00',
                    'Local_OverSeas',
                    '00',
                    'ProfitCenter',
                    '0000',
                    'Hub',
                    '000' 
                            ];

因此,由于MainAccount之后还有5个细分, 5 维数的值。 *

现在在你的代码中使用它:

AxLedgerJournalTrans    trans   = new AxLedgerJournalTrans();
trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetcon));

不要忘记使用AxdDimensionUtil :: getLedgerAccountId方法放置容器,如上所示。