我怎样才能写出客户的所有尺寸?我可以使用这段代码,但它的结果只是部门=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)));