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.

image

But I wanted to be able to fetch out only the attribute names and values from X++, that had values.

image

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()));
    }
}

15 thoughts on “Get product attributes from X++

  1. Hi Kurt,

    I want to get Retail Attribute text value of SalesLine for a particular Attribute.

    And I am not sure how to get it. Please suggest how get it.

    Like

  2. I just had to quickly write this in SQL this gets me what I want

    SELECT
    d.TEXTVALUE AS textvalue,
    a.ITEMID AS itemid,
    c.name
    FROM InventTable a,
    ecoResProductAttributeValue b,
    ecoResAttribute c,
    ecoResValue d
    WHERE a.PRODUCT = b.PRODUCT
    AND b.ATTRIBUTE = c.RECID
    AND b.VALUE = d.RECID
    AND c.ATTRIBUTETYPE = ‘5637151588’ –specify attribute

    Liked by 1 person

  3. Hello,
    I want create relation between inventTable and Product attribute value. The purpose is to use Product attribute in any AX report as filter/ criteria. Is it possible?

    Like

  4. Hi
    Do you know why you can not use the Office Add-in tool to update the table InventTableModule, something you can do to have it fixed?
    What I would like to use it for is to have a better overview over our prices and update from Excel to AX with new prices. It is the last part for me that does not work, To push back new prices from Excel to AX

    Like

    • Hi Claes.
      The AX 2012 R1/FP had about 40% table coverage, as I’m sure that you have experienced. Microsoft has learned from this, and in the R2 release scheduled for 1/12/2012 they Increase this to 95% coverage. So this is the solution…. wait until R2 (if possible).

      The other thing I learned at the Tech Conferance this week, was some VERY NICE features in the Retail module, that you should look into. It’s called Mass Update Worksheet. I think this feature will solve many of Your issues of updating prices and other Properties on the InventtableModule. Take a look here : http://technet.microsoft.com/en-us/library/hh580603.aspx

      Keep fighting Claes, it’s Worth it πŸ™‚

      Like

Leave a Reply to Yesudeva Rao Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.