2

How can i write all dimensions of customer? I can use this code but it result just 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)));

But i want if dimension is empty result is empty. For the example below result should be like this;

BusinessUnit = 
Department   = 022
Project      = 
ServiceLine  =

related image

How can i do this?

FH-Inway
  • 4,432
  • 1
  • 20
  • 37
Mumble
  • 141
  • 1
  • 8

1 Answers1

2

Try changing your code to the below. I don't have the same dimension that you have, so you might need to tweak it.

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)));
Alex Kwitny
  • 11,211
  • 2
  • 49
  • 71