Creating Dimension Attribute Value Set ID

//Code written by Ahmed Alam on 19th Dec, 2012
//ReasonCode: To save the dimension value from container variable and return the RecId
private static recId getDimensionAttributeValueSetId(container _dimensionValue, dataAreaId _dataAreaId = curext())
{
recId dimensionId;
DimensionAttributeValueSetStorage storage;
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue;
int attributeCount, attributeIndex;
str attributeName, attributeValue;
int containerElementIndex, counter;

changecompany(_dataAreaId)
{
containerElementIndex = 1;

storage = new DimensionAttributeValueSetStorage();
for(Counter = 1; counter <= conLen(_dimensionValue); counter+= 3)
{
// Get attribute count
attributeCount = conPeek(_dimensionValue, containerElementIndex);
containerElementIndex++;

// Get attribute name
attributeName = conPeek(_dimensionValue, containerElementIndex);
containerElementIndex++;

// Validate the Financial Dimenion that was passed in.
dimensionAttribute = AxdDimensionUtil::validateFinancialDimension(attributeName);

// Get attribute value
attributeValue = conPeek(_dimensionValue, containerElementIndex);
containerElementIndex++;

// Validate the Financial Dimenion Value that was passed in.
dimensionAttributeValue = AxdDimensionUtil::validateFinancialDimensionValue(dimensionAttribute, attributeValue);

// Add attribute
storage.addItem(dimensionAttributeValue);
}
dimensionId = storage.save();
}

return dimensionId;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s