Monday 2 November 2015

Fetch Product Attribute value in [AX 2012]

Fetching Product Attribute value in Ax 2102 is little bit tricky.................
Recently I was a requirement in SSRS report to fetch Product Attribute value. Job seems very easy but after lot of trouble shooting, I explored that there is three major tables as bellow mentioned tables and job...

EcoResProductAttributeValue 
EcoResAttribute              
EcoResValue                   


static void ProductAttributevalue(Args _args)
{
EcoResProductAttributeValue ecoResProductAttributeValue;
AttributeValueText          attributeValueText;
InventTable                 inventTable;  
EcoResAttribute             ecoResAttribute;
EcoResValue                 ecoResValue;


while select crosscompany  InventTable where InventTable.itemid ==  'Item001'
{
    while select crosscompany Product,Attribute,Value from ecoResProductAttributeValue
        where ecoResProductAttributeValue.Product == InventTable.Product
    {
        select crosscompany RecId from ecoResAttribute
             where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId;

        select crosscompany ecoResValue
             where ecoResValue.RecId == ecoResProductAttributeValue.Value;
        info(strFmt("%1",ecoResValue.value()));
    }
}
}

hope it will help.........

Happy DAXing :-)

No comments:

Post a Comment

Import General journal from excel in D365 F&O

 Hi Guys, Import General journal from excel in D365 F&O Code:  using System.IO; using OfficeOpenXml; using OfficeOpenXml.ExcelPackage; u...