10 Eylül 2014 Çarşamba

AX 2012 - Add a new dimension value to Default dimension

I wrote this code from one of Eyüp Tezar's code:

DimensionDefault DefDim;
DimensionAttribute                  dimensionAttribute;
DimensionAttributeValue             newValue;
DimensionAttributeValueSetStorage   dimensionStorage;


DefDim = mytable.Defaultdimension;

dimensionAttribute = DimensionAttribute::find(myDimRecid);


newValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,
        myDimValue,false,true);

dimensionStorage = DimensionAttributeValueSetStorage::find(DefDim);
dimensionStorage.addItem(newValue);

DefDim = dimensionStorage.save();

//------------------- another dimension ------------------------

dimensionAttribute = DimensionAttribute::findbyName("Project");


newValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,
        myDimValue2,false,true);

dimensionStorage = DimensionAttributeValueSetStorage::find(DefDim);
dimensionStorage.addItem(newValue);

DefDim = dimensionStorage.save();

Hiç yorum yok:

Yorum Gönder