Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

get Item category in X++

Posted on by 335

private void getItemCategory(ItemId _itemid)
{
ItemId itemId = "ITEMNO-000000572";//"ITEMID-000104";
EcoResProductCategory EcoResProductCategory;
EcoResCategory EcoResCategory;
EcoResProduct EcoResProduct;
InventTable InventTable;
;

select EcoResCategory
join EcoResProductCategory
join EcoResProduct
join InventTable
where EcoResCategory.RecId == EcoResProductCategory.Category
&& EcoResProduct.RecId == EcoResProductCategory.Product
&& EcoResProduct.RecId == InventTable.Product
&& InventTable.ItemId== itemid ;

{
info(strFmt("%1",EcoResCategory.Name));
//return EcoResCategory.Name;

}
}

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: get Item category in X++

    Hi,

    You can get the Category name from the EcoResCategory table.

    Here is the query.

    select * from EcoResCategory
    join EcoResProductCategory
    join Inventtable
    where EcoResCategory.RecId == EcoResProductCategory.Category
    && EcoResProductCategory.Product == Inventtable.Product
    && Inventtable.ItemId ==  'ItemId';

    info(strfmt('%1', EcoResCategory.CODE));

    Let me know if you have any questions.

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: get Item category in X++

    Why are you spamming this forum with code snippets without any explanation? What kind of help are you looking for here?

    Also, please use </> button in the rich formatting view to paste source code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans