X++

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

I appreciate that I can be a part of this worldwide blog community—as a consultant working from Norway, the blog lets me share more than 20 years of experience with Microsoft Dynamics 365. Along the way, I developed retail, PDA/RF, barcoding, master data, kitting and WMS-solutions for Dynamics. My blog focuses on my deepest interests and expertise: along with a 360 degree view of warehouse management topics, I welcome opportunities to dive into retail and intercompany supply chain automation, logistics, and production—everything that is moving around in a truly connected enterprise. As executive consultant on Dynamics 365, I specialize in strategic development and planning for corporate vertical solutions and works to build international networks that increase knowledge and understanding for Dynamics AX. As an advocate for both providers and customers, I'm committed to ensure that customers meet constantly changing needs, and I see community as key for increasing expertise.

12 comments on “Get product attributes from X++

  1. 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

  2. Thanks, really helpful post .

    I have a question , what if i need to get this from all in SQL query not in X++ extension ?

    Can you please help me in that .

    Like

  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. Yesudeva Rao

    thanx its very useful..

    Like

  5. your post is very helpful. Thank you so much for sharing…..

    Like

  6. 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

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 )

Google photo

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

Twitter picture

You are commenting using your Twitter 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.

%d bloggers like this: