Pages

Banner 468 x 60px

 

Wednesday, November 22, 2017

Get product attributes from X++ :

0 comments
Get product attributes from X++ :

The product attributes is a nice feature, where we can add attributes to the products without adding any additional fields on to the inventory table.
But I wanted to be able to fetch out only the attribute names and values from X++, that had values.

Here is how I solved it.
 
static void Demo_GetProductAttributes(Args _args)
{
    inventTable                 InventTable;
    EcoResProductAttributeValue ecoResProductAttributeValue;
    EcoResAttribute             ecoResAttribute;
    EcoResValue                 ecoResValue;
 
    while select InventTable where InventTable.itemid == "1604"
        join RecId from ecoResProductAttributeValue
        where ecoResProductAttributeValue.Product == InventTable.Product
            join Name from ecoResAttribute
            where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId
                join ecoResValue
                where ecoResValue.RecId == ecoResProductAttributeValue.Value
    {
        info(strFmt("%1 - %2 - %3", InventTable.ItemId, ecoResAttribute.Name, ecoResValue.value()));
    }
}




0 comments:

A financial dimension value is based on the LAND-00013 record and has been used on a transaction. You cannot delete the LAND-00013 record AX 2012

 A financial dimension value is based on the LAND-00013 record and has been used on a  transaction. You cannot delete the LAND-00013 record ...