Skip to main content

Notifications

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.

  • Shankar Profile Picture
    75 on at
    RE: How can I print item attributes value

    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.

  • Shankar Profile Picture
    75 on at
    RE: How can I print item attributes value

    Yes ok Thankyou

  • Suggested answer
    Nitin Verma Profile Picture
    21,565 Moderator on at
    RE: How can I print item attributes value

    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
    RE: How can I print item attributes value

    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,565 Moderator on at
    RE: How can I print item attributes value

    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
    RE: How can I print item attributes value

    I tries this still my value is not coming.

  • Nitin Verma Profile Picture
    21,565 Moderator on at
    RE: How can I print item attributes value

    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;
    

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans