Interview Questions

Tuesday, September 27, 2016

Updating the value of existing dimesnions - Default dimension

Here is a code to update the value of particular dimensions for items

InventTable inventTable;

DimensionAttributeValueSetStorage dimStorage;

DimensionAttribute dimAttrOpDiv;

DimensionAttributeValue dimAttributeValue;

while select forUpdate inventTable
{
ttsBegin;
dimStorage = DimensionAttributeValueSetStorage::find(inventTable.DefaultDimension);
dimAttrOpDiv = DimensionAttribute::findByName("DIMENSION NAME);
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrOpDiv,'VALUE'truetrue);
dimStorage.addItem(dimAttributeValue);
inventTable.DefaultDimension = dimStorage.save();
inventTable.doUpdate();
ttsCommit;
}
}

No comments:

Post a Comment