Get Product Dimensions Description through X++
Views (6588)
While working on a requirement, i came across a scenario in which i want to display the description of product dimensions (Size,Color,Style,Configuration) on a form grid along with each product dimension id.This seems to be quite simple but when i go through the tables i am not able to get the description field directly from EcoResColor/EcoResSize etc tables.After doing RnD on some interlinked tables i have got the solution and finally able to achieve the desired result.
Here is the code snippet that you can use to display the description of any product dimension based on the item id and the specific dimension (Size,Color,Style,Config) id.
AX 2012 R2
EcoResProductMasterColor EcoResProductMasterColor;
EcoResProductMasterDimensionValue EcoResProductMasterDimensionValue;
EcoResColor EcoResColor;
EcoResProductMaster EcoResProductMaster;
EcoResProduct EcoResProduct;
ItemId ItemId = "DARAWK24"; //DARA KURTA
EcoResColorName EcoResColorName = "DEFAULT";
select * from EcoResProductMasterDimensionValue
join RecId from EcoResProductMasterColor
where EcoResProductMasterDimensionValue.RecId == EcoResProductMasterColor.RecId
join RecId from EcoResColor
where EcoResColor.RecId == EcoResProductMasterColor.Color
&& EcoResColor.Name == EcoResColorName
join RecId from EcoResProductMaster
where EcoResProductMasterColor.ColorProductMaster == EcoResProductMaster.RecId
&& EcoResProductMaster.DisplayProductNumber == ItemId;
info(EcoResProductMasterDimensionValue.Description);
AX 2012 R3
EcoResProductMasterColor EcoResProductMasterColor;
EcoResProductMasterDimensionValue EcoResProductMasterDimensionValue;
EcoResColor EcoResColor;
EcoResProductMaster EcoResProductMaster;
EcoResProductMasterDimValueTranslation EcoResProductMasterDimValueTranslation;
ItemId ItemId = "DARAWK24"; //DARA KURTA
EcoResColorName EcoResColorName = "DEFAULT";
select * from EcoResProductMasterDimValueTranslation
join RecId from EcoResProductMasterDimensionValue
where EcoResProductMasterDimValueTranslation.ProductMasterDimensionValue
== EcoResProductMasterDimensionValue.RecId
join RecId from EcoResProductMasterColor
where EcoResProductMasterDimensionValue.RecId == EcoResProductMasterColor.RecId
join RecId from EcoResColor
where EcoResColor.RecId == EcoResProductMasterColor.Color
&& EcoResColor.Name == EcoResColorName
join RecId from EcoResProductMaster
where EcoResProductMasterColor.ColorProductMaster == EcoResProductMaster.RecId
&& EcoResProductMaster.DisplayProductNumber == ItemId;
info(EcoResProductMasterDimValueTranslation.Name);
Result : DEF
Happy DAXing :)
This was originally posted here.
*This post is locked for comments