Forum Discussion

elhola's avatar
elhola
Copper Contributor
Nov 28, 2022

HELP with AL Development for Dynamics 365 Business Central

I need to show the table in the Brand Name field, but not all columns, but only two (Code and Description). The field "Brand Name" should be similar to the work of the field "Serial Nos.". Look, when the field expands, a table with two columns appears. I need the same, you know?
That is, I mean that I need the Code column and the Description column in the same form as the Serias Nos. field (code and description)

I need the same field, but I will name it the "brand name" and there I will have a Item table with a code and description.

 

My code:

tableextension 50115 "Brand Name" extends "Item"
{
    DataCaptionFields = "No.", Description;
    fields
    {

 

        field(50105; "Brand Name"; Text[250])
        {
            Caption = 'Brand Name';
            Description = 'It is a code and description';
            Editable = true;
            TableRelation = Item."No.";
            DataClassification = ToBeClassified;
        }
    }
}
pageextension 50115 ItemBrandPageExt extends "Item Card"
{
    layout
    {
        addlast(Item)
        {
            field("Brand Name";Rec."Brand Name")
            {
                ApplicationArea = All;
                Caption = 'Brand Name';
                ToolTip = 'It is code and description';
            }
        }
    }
}
 
query 50115 ItemBrandQuery
{
    Caption = 'ItemBrandQuery';
    QueryType = Normal;
    QueryCategory = 'Item';
    elements
    {
        dataitem(Item; Item)
        {
            column(No; "No.")
            { Caption = 'Code';
            }
            column(Description; Description)
            {Caption = 'Description';
            }
        }
    }
    trigger OnBeforeOpen()
    begin
    end;
}

Resources