web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

How can I print item attributes value

(0) ShareShare
ReportReport
Posted on by 75

Here I need to print item attributes value colour Red and depth and height

Screenshot_5F00_20230516_2D00_172906.jpg

codeunit 50107 ParentChildItem

{

procedure MyProcedure()

var

ItemCard: Record Item;

ItemAttrinuteValue: Record "Item Attribute Value Selection"; begin

ItemCard.SetRange("No.", ItemAttrinuteValue."Inherited-From Key Value");

if ItemCard.FindSet() then repeat 

ItemAttrinuteValue.SetRange("Inherited-From Key Value", ItemCard."No.");

if ItemAttrinuteValue."Attribute Name" = 'Colour' then Message('%1 Parent And Child Items',ItemAttrinuteValue."Attribute Name");

end;

until ItemCard.Next() = 0;

end;

}

This is my. Code my color depth and height is not printed in message what's wrong please help.

I have the same question (0)
  • Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    Can you try this functions?

    procedure MyProcedure()
        var
            ItemCard: Record Item;
            ItemAttrinuteValue: Record "Item Attribute Value Selection";
        begin
            ItemCard.Reset();
            itemcard.SetRange("No.",);
            if ItemCard.FindSet() then
                repeat
                    ItemAttrinuteValue.reset;
                    ItemAttrinuteValue.SetRange("Inherited-From Key Value", ItemCard."No.");
                    ItemAttrinuteValue.SetFilter("Attribute Name", '%1', 'Colour');
                    if ItemAttrinuteValue.FindFirst() then
                        Message('%1 Parent And Child Items', ItemAttrinuteValue."Attribute Name");
                until ItemCard.Next() = 0;
        end;
    

  • Shankar Profile Picture
    75 on at

    I tries this still my value is not coming.

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Ok, try this now.

     procedure MyProcedure()
        var
            ItemCard: Record Item;
            ItemAttributeValue: Record "Item Attribute Value";
            ItemAttributeValueMapping: Record "Item Attribute Value Mapping";
        begin
            ItemCard.Reset();
            itemcard.SetRange("No.", '1896-S');
            if ItemCard.FindSet() then
                repeat
                    ItemAttributeValueMapping.SetRange("Table ID", DATABASE::Item);
                    ItemAttributeValueMapping.SetRange("No.", ItemCard."No.");
                    if ItemAttributeValueMapping.FindSet() then
                        repeat
                            ItemAttributeValue.reset;
                            ItemAttributeValue.SetRange("Attribute ID", ItemAttributeValueMapping."Item Attribute ID");
                            ItemAttributeValue.SetRange(id, ItemAttributeValueMapping."Item Attribute Value ID");
                            ItemAttributeValue.SetFilter("Attribute Name", '%1', 'Color');
                            if ItemAttributeValue.FindFirst() then begin
                                Message('%1 Parent And Child Items', ItemAttributeValue.Value);
                                exit;
                            end;
                        until ItemAttributeValueMapping.Next() = 0;
                until ItemCard.Next() = 0;
        end;

  • Shankar Profile Picture
    75 on at

    Hi,as you pass id ? There I am getting error, is it Attribute I'd? Or? Please can you make clear that

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    The id is coming from the mapping table I am not receiving any error please check the item no. What you have passed here.

  • Shankar Profile Picture
    75 on at

    Yes ok Thankyou

  • Shankar Profile Picture
    75 on at

    If I need to print color for all item no in my message? Only by No passing in set strange will do?

    Want to check that.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,909 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,145 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 974

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans