X++ code to get Derived dimension
public static str derivedDim(str _dimAttrName,str _dimValue)
{
//_dimAttrName Base dimension
// _dimValue Base dimension value
DimensionAttributeValueDerivedDimensions derivedDim;
DimensionAttribute dimAttribute;
DimensionAttributeValue dimAttriValue;
str derivedDimValue;
dimAttribute = DimensionAttribute::findByName(_dimAttrName);
if(dimAttribue)
{
dimAttriValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttribute,_dimValue);
derivedDim = DimensionAttributeValueDerivedDimensions::findByDimensionAttributeValue(dimAttribute.RecId,dimAttriValue.RecId);
dimAttriValue = DimensionAttributeValue::find(derivedDim.DerivedDimensionAttributeValue1);
select firstonly derivedDim where derivedDim.DimensionAttribute == dimAttribute.RecId;
dimAttribute = DimensionAttribute::find(derivedDim.DimensionAttribute);
if(dimAttribute)
{
derivedDimValue = dimAttriValue.DisplayValue;
}
}
return derivedDimValue;
}
Thanks for reading!!
No comments:
Post a Comment