Tuesday, September 12, 2017

Get product attributes and values for all product in AX 2012

Get product attributes and values for all product in AX 2012

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

    while select inventTable
           //where inventTable.ItemId == "TestProduct"
join ecoResProductAttributeValue
         where ecoResProductAttributeValue.Product == inventTable.Product
         join ecoResAttribute where ecoResAttribute.RecId == ecoResProductAttributeValue.Attribute
             join ecoResValue where ecoResValue.RecId == ecoResProductAttributeValue.Value
    {
        info(strfmt("%1,%2, %3", inventTable.ItemId, ecoResAttribute.Name,ecoResValue.value()));
    }
}

No comments:

Post a Comment

Search hierarchy for a match (TableALLGroup) X++

  Table1 ppt;  select firstonly ppt  order ItemCode, ItemRelation, AccountCode, AccountRelation where      (ppt.ItemCode == TableGroupAll::T...