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...
Suggested Answer

Table creation

(0) ShareShare
ReportReport
Posted on by 44

Hi All,

I'm trying to create a New Page from a New table.

The issue im having is t hat the fields do not populate themselves.

I require the following
Item
Description
SKU

Bin Code
 

This is my Table

table 50111 "X_Item Report"
{
    Caption = 'X_Item Report';
    DataClassification = ToBeClassified;

    fields
    {
        field(1; "Item No "; Text[100])
        {
            Caption = 'Item No ';
            DataClassification = ToBeClassified;
            TableRelation = Item."No.";
        }
        field(2; Description; Text[200])
        {
            Caption = 'Description';
            DataClassification = ToBeClassified;
            TableRelation = Item.Description where(Description = field("Item No "));

          
        }
        field(3; SKU; Code[50])
        {
            Caption = 'SKU';
            DataClassification = ToBeClassified;
            TableRelation = "Stockkeeping Unit"."Item No." where("Item No." = field("Item No "));
        }
        field(4; "Bin"; Text[100])
        {
            Caption = 'Bin of last occurance';
            DataClassification = Tobeclassified;
            TableRelation = "Bin Content"."Bin Code" where("Item No." = field("Item No "));
        }
    }
    keys
    {
        key(PK; "Item No ")
        {
            Clustered = true;
        }
    }
}

I tried using a trigger, however it doesn't seem to be picking up the fields.

This is the trigger i tried using for the description

  trigger OnValidate()
            var
                recDesc: Record "Item";
            begin
                if "Item No " = "Item No "
                then
                    if recDesc.get("Description") then begin
                        "Description" := "Description"
                    end;
            end;

Any assistance would be greatly appreciated

  • rajivsewsarran Profile Picture
    44 on at

    ok, so ive sorted that , simple errors on my part.

    Now i've created a table extension to extend the "Item" table with the field "Stockkeeping Unit"

    I need this to look at the item number and populate the field.

    This is what i used, can someone tell how where i went wrong?

    tableextension 50113 SKU extends Item

    {

       fields

       {

           field(50113; SKU; Code[30])

           {

               TableRelation = "Stockkeeping Unit"."Location Code" where("Location Code" = field("No."));

               Caption = 'SKU';

               DataClassification = ToBeClassified;

               trigger OnValidate()

               var

                   RecSKU: Record "Stockkeeping Unit";

               begin

                   if xRec."No." = Rec."No."

                   then

                       if recSKU.get(SKU) then begin

                           SKU := rec.SKU

                       end;

               end;

           }

       }

    }

  • rajivsewsarran Profile Picture
    44 on at

    This is what i have so far , that doesn't work

    tableextension 50113 SKU extends Item
    {
        fields
        {
            field(50113; SKU; Code[30])
            {
                TableRelation = "Stockkeeping Unit"."Location Code" where("Item No."= field("No."));
                Caption = 'SKU';
                DataClassification = ToBeClassified;
            }
        }
        local procedure YIR(var Item: Record Item; LocationCode: Code[10]; VariantCode: Code[10])
        var
            SKU: Record "Stockkeeping Unit";
        begin
            if item.get("No.") then
                if SKU.get(LocationCode, Item."No.", VariantCode) then
                    Item."Shelf No." := SKU."Shelf No.";
        end;
    
    }
    

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

    Hi rajivsewsarran

    Please try below

    tableextension 50113 SKU extends Item

    {

       fields

       {

           field(50113; SKU; Code[30])

           {

               TableRelation = "Stockkeeping Unit"."Location Code" where("Item No."= field("No."));

               Caption = 'SKU';

               DataClassification = ToBeClassified;

           }

       }

       local procedure YIR(var Item: Record Item; LocationCode: Code[10]; VariantCode: Code[10])

       var

           SKU: Record "Stockkeeping Unit";

       begin

           if item.get("No.") then

               if SKU.get(LocationCode, Item."No.", VariantCode) then

    begin

                   Item."Shelf No." := SKU."Shelf No.";

    item.modiy;

    end;

       end;

    }

  • rajivsewsarran Profile Picture
    44 on at

    tableextension 50120 Bin extends Item
    {
        fields
        {
            field(50120; Bin; Code[30])
            {
                TableRelation = "Bin Content"."Bin Code" where("Item No." = field("No."));
                Caption = 'Bin';
                DataClassification = ToBeClassified;
            }
        }
        local procedure YIR(var Item: Record Item; LocationCode: Code[10]; VariantCode: Code[10])
        var
            Bin: Record "Bin Content";
        begin
            if item.get("No.") then
                if Bin.get(LocationCode, Item."No.", VariantCode) then begin
                    Bin."Item No." := Bin."Bin Code";
                    item.modify;
                end;
        end;
    }
    
    
    
    
    pageextension 50120 Bin extends "Item List"
    {
        layout
        {
            addafter(Type)
            {
                field(Bin; Rec.Bin)
                {
                    ApplicationArea = all;
                    Caption = 'Bin';
                }
            }
        }
    }

    Hi Nitin,

    thanks again for your help with this.

    I tried applying the same logic getting the "Bin Code" from the "Bin Contents" table but it doesn't seem to work either

    I still cant see what im doing wrong.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 768 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 541 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 324 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans