Page 8700 Table Information

App
System Application
Namespace
System.DataAdministration
Versions
17-28
Source table
2000000028

Versions171819202122232425262728

Source242526272829

Source in 29

src/System Application/App/Table Information/src/TableInformation.Page.al181 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.DataAdministration;

using System.Diagnostics;
using System.Environment;
using System.Reflection;
using System.Security.AccessControl;
using System.Security.User;

/// <summary>
/// The Table Information page shows information about database tables.
/// </summary>
page 8700 "Table Information"
{
    Caption = 'Table Information';
    AdditionalSearchTerms = 'Database,Size,Storage,Index';
    PageType = List;
    ApplicationArea = All;
    Extensible = true;
    UsageCategory = Lists;
    SourceTable = "Table Information";
    SourceTableView = sorting("Size (KB)") order(descending);
    Editable = false;
    InsertAllowed = false;
    ModifyAllowed = false;
    DeleteAllowed = false;
    Permissions = tabledata "Table Information" = r,
                  tabledata "Database Index" = r,
                  tabledata "Table Metadata" = r;
    AboutTitle = 'About Table Information';
    AboutText = 'Get information about the number of records in all system and business tables, and how much data each table contains. This information is useful for troubleshooting performance problems, because it lets you see the distribution of data size across tables.';

    layout
    {
        area(Content)
        {
            repeater(General)
            {
                field("Company Name"; Rec."Company Name")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the name of the company the table belongs to.';
                }

                field("Table Name"; Rec."Table Name")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the name of the table.';
                }

                field("Table No."; Rec."Table No.")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the ID of the table.';

                    trigger OnDrillDown()
                    begin
                        OpenTableDataManagement();
                    end;
                }

                field("No. of Records"; Rec."No. of Records")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the total number of records stored in the table.';

                    trigger OnDrillDown()
                    var
                        TableInformationCacheImpl: Codeunit "Table Information Cache Impl.";
                    begin
                        Hyperlink(TableInformationCacheImpl.GetTableUrl(Rec."Company Name", Rec."Table No."));
                    end;
                }

                field("Record Size (Byte)"; Rec."Record Size")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the average record size (in bytes).';
                    AutoFormatType = 0;
                }

                field("Size (KB)"; Rec."Size (KB)")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the total amount of space the table occupies in the database (in kilobytes).';
                }

                field("Data Size (KB)"; Rec."Data Size (KB)")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies how much space the table data occupies in the database (in kilobytes).';
                }

                field("Index Size (KB)"; Rec."Index Size (KB)")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies how much space the table indexes (keys) occupy in the database (in kilobytes).';
                }

                field(Compression; Rec."Compression")
                {
                    ApplicationArea = All;
                    OptionCaption = 'None,Row,Page,,';
                    ToolTip = 'Specifies the type of compression that is applied to the table in the database.';
                }
            }
        }
    }

    actions
    {
        area(Processing)
        {
            action("Manage Indexes")
            {
                ApplicationArea = All;
                Caption = 'Manage Indexes';
                Image = "Table";
                Scope = Repeater;
                ToolTip = 'Manage indexes on the selected table. You can investigate index cost and usage, and turn indexes on/off.';

                trigger OnAction()
                begin
                    OpenTableDataManagement();
                end;
            }
        }
        area(Promoted)
        {
            group(Category_Process)
            {
                actionref(ManageIndexesPromoted; "Manage Indexes")
                {
                }
            }
        }
        area(Navigation)
        {
            action("View Table Permissions")
            {
                ApplicationArea = All;
                Caption = 'View Table Permissions';
                Image = Permission;
                Scope = Repeater;
                ToolTip = 'View an overview of permissions that apply to this table across all permission sets.';

                trigger OnAction()
                var
                    PermissionsOverviewCU: Codeunit "Permissions Overview";
                begin
                    PermissionsOverviewCU.OpenForTable(Rec."Table No.");
                end;
            }
        }
    }

    trigger OnInit()
    var
        UserPermissions: Codeunit "User Permissions";
    begin
        Rec.FilterGroup(2);
        if UserPermissions.IsSuper(UserSecurityId()) then
            Rec.SetRange("Company Name")
        else
            Rec.SetFilter("Company Name", '%1|%2', '', CompanyName);
        Rec.FilterGroup(0);
    end;

    local procedure OpenTableDataManagement()
    var
        TableMetadata: Record "Table Metadata";
    begin
        TableMetadata.SetRange(ID, Rec."Table No.");
        Page.Run(Page::"Table Information Card", TableMetadata);
    end;
}