This method would return a map- a key value pair.
The key gives the segment name, whereas the value gives the segment value.
private Map getDimAttributes(DimensionAttributeValueCombination _DimensionAttributeValueCombination)
{
DimensionAttributeValueCombination dimAttrValueComb;
DimensionStorage dimensionStorage;
DimensionStorageSegment segment;
int segmentCount, segmentIndex;
int hierarchyCount, hierarchyIndex;
str segmentName, segmentDescription;
SysDim segmentValue;
str retVal;
;
DimAttributesMap = new Map(Types::String,Types::String);
dimAttrValueComb = DimensionAttributeValueCombination::find(_DimensionAttributeValueCombination.RecId);
dimensionStorage = DimensionStorage::findById(dimAttrValueComb.RecId);
if (dimensionStorage == null)
{
return DimAttributesMap;
}
hierarchyCount = dimensionStorage.hierarchyCount();
for(hierarchyIndex = 1; hierarchyIndex <= hierarchyCount; hierarchyIndex++)
{
segmentCount = dimensionStorage.segmentCountForHierarchy(hierarchyIndex);
for (segmentIndex = 1; segmentIndex <= segmentCount; segmentIndex++)
{
segment = dimensionStorage.getSegmentForHierarchy(hierarchyIndex, segmentIndex);
if (segment.parmDimensionAttributeValueId() != 0)
{
segmentName = DimensionAttribute::find(DimensionAttributeValue::find(segment.parmDimensionAttributeValueId()).DimensionAttribute).Name;
DimAttributesMap.insert(segmentName,segment.parmDisplayValue());
}
}
}
return DimAttributesMap;
}
No comments:
Post a Comment