Dynamics 365 Business Central: How to add multiple new lines between records (MultipleNewLines Property)

Dynamics 365 Business Central

Hi, Readers.
Today, I would like to talk about how to add multiple new lines between records in Business Central.

What does this mean? Let’s look at an example first.
While creating a sales order, after inserting few sales order lines, you can have additional blank lines before entering a set of line items.

PS: These blank lines have actually been saved in the table.

But on other pages such as Physical Inventory Orders and General Journals, you cannot do this.

Why? You can find the answer in the Base Application. On the Sales Order Subform page, the MultipleNewLines property is set to true.

page 46 “Sales Order Subform”: MultipleNewLines = true;

page 5877 “Physical Inventory Order Subf.”:

page 39 “General Journal”:

MultipleNewLines Property: Sets a value that determines whether users can add multiple new lines between records.

Applies to:

  • Page
  • Request Page

Property Value: True if you want to allow users to add multiple new lines between records; otherwise, false. The default is false.

Note: The property ‘MultipleNewLines’ cannot be customized.

So, you can use MultipleNewLines property to add multiple new lines between records on your new page.

However, please note that because blank lines are also automatically inserted into the database, the page will get an error if the Key is not automatically created.

The best practice is to use the AutoSplitKey Property to automatically create a key for a new record, as in the Base Application.

Test Video:

Source Code: for reference only

page 50101 "Lab Book List"
{
    PageType = List;
    UsageCategory = Lists;
    ApplicationArea = All;
    SourceTable = "Lab Book";
    MultipleNewLines = true;
    AutoSplitKey = true;
    Caption = 'Book List';

    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field("No."; Rec."No.")
                {
                    ApplicationArea = All;
                }
                field(Title; Rec.Title)
                {
                    ApplicationArea = All;
                }
                field(Author; Rec.Author)
                {
                    ApplicationArea = All;
                }
                field(Hardcover; Rec.Hardcover)
                {
                    ApplicationArea = All;
                }
                field("Page Count"; Rec."Page Count")
                {
                    ApplicationArea = All;
                }

            }
        }
    }
}

table 50100 "Lab Book"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; "No."; Integer)
        {
            Caption = 'No.';
            DataClassification = CustomerContent;
        }
        field(2; Title; Text[30])
        {
            Caption = 'Title';
            DataClassification = CustomerContent;
        }
        field(3; Author; Text[30])
        {
            Caption = 'Author';
            DataClassification = CustomerContent;
        }
        field(4; Hardcover; Boolean)
        {
            Caption = 'Hardcover';
            DataClassification = CustomerContent;
        }
        field(5; "Page Count"; Integer)
        {
            Caption = 'Page Count';
            DataClassification = CustomerContent;
        }
    }

    keys
    {
        key(PK; "No.")
        {
            Clustered = true;
        }
    }
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

タイトルとURLをコピーしました