Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

get Item category in X++

(0) ShareShare
ReportReport
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
    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
    233,334 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
shanawaz davood basha Profile Picture

shanawaz davood basha 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans