Dynamic AX 2012 R3 写入客户的空财务维度
Dynamic AX 2012 R3 Write Empty Financial Dimensions of Customer
如何写客户的所有维度?我可以使用此代码,但结果只是 Department = 022。
CustTable custTable = CustTable::find("10112");
DimensionAttributeValueSetStorage dimStorage;
Counter i;
dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
for (i=1 ; i<= dimStorage.elements() ; i++)
{
info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,
dimStorage.getDisplayValueByIndex(i)));
但我想如果维度为空结果为空。对于下面的示例,结果应该是这样的;
BusinessUnit =
Department = 022
Project =
ServiceLine =
我该怎么做?
尝试将您的代码更改为以下内容。我没有和你一样的尺寸,所以你可能需要调整它。
CustTable custTable = CustTable::find("10112");
DimensionAttribute segment = DimensionAttribute::findByName('Segment');
DimensionAttribute department = DimensionAttribute::findByName('Department');
DimensionAttribute businessType = DimensionAttribute::findByName('BusinessType');
DimensionAttribute serviceLine = DimensionAttribute::findByName('ServiceLine');
DimensionAttributeValueSetStorage dimStorage;
dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
info(strFmt("%1 = %2", segment.Name, dimStorage.getDisplayValueByDimensionAttribute(segment.RecId)));
info(strFmt("%1 = %2", department.Name, dimStorage.getDisplayValueByDimensionAttribute(department.RecId)));
info(strFmt("%1 = %2", businessType.Name, dimStorage.getDisplayValueByDimensionAttribute(businessType.RecId)));
// You make need to tweak these
info(strFmt("%1 = %2", serviceLine.Name, dimStorage.getDisplayValueByDimensionAttribute(serviceLine.RecId)));
如何写客户的所有维度?我可以使用此代码,但结果只是 Department = 022。
CustTable custTable = CustTable::find("10112");
DimensionAttributeValueSetStorage dimStorage;
Counter i;
dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
for (i=1 ; i<= dimStorage.elements() ; i++)
{
info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name,
dimStorage.getDisplayValueByIndex(i)));
但我想如果维度为空结果为空。对于下面的示例,结果应该是这样的;
BusinessUnit =
Department = 022
Project =
ServiceLine =
我该怎么做?
尝试将您的代码更改为以下内容。我没有和你一样的尺寸,所以你可能需要调整它。
CustTable custTable = CustTable::find("10112");
DimensionAttribute segment = DimensionAttribute::findByName('Segment');
DimensionAttribute department = DimensionAttribute::findByName('Department');
DimensionAttribute businessType = DimensionAttribute::findByName('BusinessType');
DimensionAttribute serviceLine = DimensionAttribute::findByName('ServiceLine');
DimensionAttributeValueSetStorage dimStorage;
dimStorage = DimensionAttributeValueSetStorage::find(custTable.DefaultDimension);
info(strFmt("%1 = %2", segment.Name, dimStorage.getDisplayValueByDimensionAttribute(segment.RecId)));
info(strFmt("%1 = %2", department.Name, dimStorage.getDisplayValueByDimensionAttribute(department.RecId)));
info(strFmt("%1 = %2", businessType.Name, dimStorage.getDisplayValueByDimensionAttribute(businessType.RecId)));
// You make need to tweak these
info(strFmt("%1 = %2", serviceLine.Name, dimStorage.getDisplayValueByDimensionAttribute(serviceLine.RecId)));