//Function for default dimnesion ax 2012
DimensionDefault DefaultDimensionCreate(Description _BU,Description _CC,Description _Department)
{
DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
DimensionDefault result;
int i;
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue; //DimensionAttributeValueCombination
container conAttr = ["BusinessUnit","CostCenter","Department"]; //101,106,1
container conValue;
str dimValue;
conValue = [_BU,_CC,_Department];
dimValue = "";
i = 0;
for (i = 1; i <= conLen(conAttr); i++)
{
dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
if (dimensionAttribute.RecId == 0)
{
continue;
//control will not go down
}
dimValue = conPeek(conValue,i);
if (dimValue != "")
{
dimensionAttributeValue =
dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
valueSetStorage.addItem(dimensionAttributeValue);
}
}
result = valueSetStorage.save();
return result;
}
DimensionDefault DefaultDimensionCreate(Description _BU,Description _CC,Description _Department)
{
DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
DimensionDefault result;
int i;
DimensionAttribute dimensionAttribute;
DimensionAttributeValue dimensionAttributeValue; //DimensionAttributeValueCombination
container conAttr = ["BusinessUnit","CostCenter","Department"]; //101,106,1
container conValue;
str dimValue;
conValue = [_BU,_CC,_Department];
dimValue = "";
i = 0;
for (i = 1; i <= conLen(conAttr); i++)
{
dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
if (dimensionAttribute.RecId == 0)
{
continue;
//control will not go down
}
dimValue = conPeek(conValue,i);
if (dimValue != "")
{
dimensionAttributeValue =
dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
valueSetStorage.addItem(dimensionAttributeValue);
}
}
result = valueSetStorage.save();
return result;
}
No comments:
Post a Comment