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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Item attributes

(0) ShareShare
ReportReport
Posted on by 555

Hi experts,

I have made an extension to Business Central cloud.

On my own table, I would like to have a field, where the user can select one of the item attributes and save the selected item attribute on my table.

The problem is that item attributes have an integer as unique key and I only want my user to see the name of the item attribute, when he/she selects it.

For instance, if I have these item attribute records:

1, Weight

2, Color

3 Height

then I want the user to select between Weight, Color and Height and it must only be the selected value (eg. "Color"), that is shown in my new field on my new table.

How do I do that?

I have these two files:

table 50101 "myTable"
{
    Caption = 'my';

    fields
    {
        field(1CodeCode[10])
        {
            Caption = 'Code';
            NotBlank = true;
        }
        field(2; Description; Text[50])
        {
            Caption = 'Desc.';
        }
        field(3; "Item Attribute 1"; Integer)
        {
            Caption = 'No. 1';
            TableRelation = "Item Attribute".ID;
        }
    }

    keys
    {
        key(Key1; Code)
        {
            Clustered = true;
        }
    }
}
Page 50102 "myPage"
{
    Caption = 'Well';
    PageType = List;
    SourceTable = myTable;
    ApplicationArea = All;
    UsageCategory = Lists;

    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field("Code";Rec.Code)
                {
                    ApplicationArea = All;
                    ToolTip = 'Well';
                }

                field(Description;Rec.Description)
                {
                    ApplicationArea = All;
                    ToolTip = 'Well';
                }                

                field("Item Attribute 1";Rec."Item Attribute 1")
                {
                    ApplicationArea = All;
                    ToolTip = 'Well';
                }
            }
        }
    }
}


I have the same question (0)
  • Suggested answer
    JAngle Profile Picture
    133 on at

    Have a look at page 7506 "Filter Items by Attribute". That one doesn’t show the integer. It is used to return an item filter but you could use it as a basis for adding data to your table. Note it has a trigger built in to it: trigger OnQueryClosePage(CloseAction: Action): Boolean

    I’d take a copy and use it as you need. It passes a temporary version of the table Filter Item Attributes Buffer.

  • Morten Steengaard Profile Picture
    555 on at

    Hi Josh,

    Thank you very much for your reply.

    I looked at the page, you suggested, and now it works fine.

    I made the field without a tablerelation:

           field(3; "Item Attribute 1"; Text[250])

           {

               Caption = 'Name';

               trigger OnValidate()

               var

                   ItemAttribute: Record "Item Attribute";

               begin

                   if Rec."Item Attribute 1" <> '' then begin

                       ItemAttribute.SetRange(Name, "Item Attribute 1");

                       if not ItemAttribute.FindFirst() then begin

                           Error('It did not exist");

                       end;

                       if Rec."Item Attribute 1" <> ItemAttribute.Name then

                           Rec."Item Attribute 1" := ItemAttribute.Name;

                   end;

               end;

           }

    and on my page, I wrote this:

                   field("Item Attribute 1";Rec."Item Attribute 1")

                   {

                       ApplicationArea = All;

                       ToolTip = 'Name';

                       TableRelation = "Item Attribute".Name;

                   }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,785

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,007 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 948 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans