Page 537 Dimension Values

App
Base Application
Namespace
Microsoft.Finance.Dimension
Versions
17-28
Source table
349

Events, 1

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Finance/Dimension/DimensionValues.Page.al219 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 Microsoft.Finance.Dimension;

/// <summary>
/// List page for managing dimension values within a specific dimension.
/// Provides comprehensive interface for creating, editing, and organizing dimension values with hierarchical support.
/// </summary>
/// <remarks>
/// Supports hierarchical dimension value structures with Begin-Total and End-Total types for reporting and analysis.
/// Includes functionality for dimension value indentation, translation management, and bulk operations.
/// </remarks>
page 537 "Dimension Values"
{
    Caption = 'Dimension Values';
    DataCaptionFields = "Dimension Code";
    DelayedInsert = true;
    PageType = List;
    SourceTable = "Dimension Value";

    layout
    {
        area(content)
        {
            repeater(Control1)
            {
                IndentationColumn = NameIndent;
                IndentationControls = Name;
                ShowCaption = false;
                field("Dimension Code"; Rec."Dimension Code")
                {
                    ApplicationArea = Dimensions;
                    Visible = false;
                    ToolTip = 'Specifies the code for the dimension.';
                }
                field("Code"; Rec.Code)
                {
                    ApplicationArea = Dimensions;
                    Style = Strong;
                    StyleExpr = Emphasize;
                    trigger OnValidate()
                    begin
                        SendSpecialCharNotification(Rec.Code);
                    end;
                }
                field(Name; Rec.Name)
                {
                    ApplicationArea = Dimensions;
                    Style = Strong;
                    StyleExpr = Emphasize;
                }
                field("Dimension Value Type"; Rec."Dimension Value Type")
                {
                    ApplicationArea = Dimensions;

                    trigger OnValidate()
                    begin
                        FormatLine();
                    end;
                }
                field(Totaling; Rec.Totaling)
                {
                    ApplicationArea = Dimensions;

                    trigger OnLookup(var Text: Text): Boolean
                    var
                        DimVal: Record "Dimension Value";
                        DimValList: Page "Dimension Value List";
                    begin
                        DimVal := Rec;
                        DimVal.SetRange("Dimension Code", Rec."Dimension Code");
                        DimValList.SetTableView(DimVal);
                        DimValList.LookupMode := true;
                        if DimValList.RunModal() = ACTION::LookupOK then begin
                            DimValList.GetRecord(DimVal);
                            Text := DimVal.Code;
                            exit(true);
                        end;
                        exit(false);
                    end;
                }
                field(Blocked; Rec.Blocked)
                {
                    ApplicationArea = Dimensions;
                }
                field("Map-to IC Dimension Value Code"; Rec."Map-to IC Dimension Value Code")
                {
                    ApplicationArea = Dimensions;
                    Visible = false;
                }
                field("Consolidation Code"; Rec."Consolidation Code")
                {
                    ApplicationArea = Dimensions;
                    Visible = false;
                }
            }
        }
        area(factboxes)
        {
            systempart(Control1900383207; Links)
            {
                ApplicationArea = RecordLinks;
                Visible = false;
            }
            systempart(Control1905767507; Notes)
            {
                ApplicationArea = Notes;
                Visible = false;
            }
        }
    }

    actions
    {
        area(processing)
        {
            group("F&unctions")
            {
                Caption = 'F&unctions';
                Image = "Action";
                action("Indent Dimension Values")
                {
                    ApplicationArea = Dimensions;
                    Caption = 'Indent Dimension Values';
                    Image = Indent;
                    RunObject = Codeunit "Dimension Value-Indent";
                    RunPageOnRec = true;
                    ToolTip = 'Indent dimension values between a Begin-Total and the matching End-Total one level to make the list easier to read.';
                }

                action("Where-Used List")
                {
                    ApplicationArea = Dimensions;
                    Caption = 'Where-Used List';
                    Image = Indent;
                    RunObject = page "Default Dimension Where-Used";
                    RunPageLink = "Dimension Code" = field("Dimension Code"), "Dimension Value Code" = field(Code);
                    ToolTip = 'View all the records where the dimension value is used as a default dimension. Note that default dimensions can only be assigned to record types, such as item, customer, and other master data cards and to selected other records, such as salespeople and fixed assets. Default dimensions cannot be assigned to documents or journal lines.';

                }
            }
        }
    }

    trigger OnNewRecord(BelowxRec: Boolean)
    begin
        FormatLine();
    end;

    trigger OnAfterGetRecord()
    begin
        FormatLine();
    end;

    trigger OnAfterGetCurrRecord()
    begin
        FormatLine();
    end;

    trigger OnOpenPage()
    var
        DimensionCode: Code[20];
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforeOnOpenPage(Rec, IsHandled);
        if IsHandled then
            exit;

        if Rec.GetFilter("Dimension Code") <> '' then
            DimensionCode := Rec.GetRangeMin("Dimension Code");
        if DimensionCode <> '' then begin
            Rec.FilterGroup(2);
            Rec.SetRange("Dimension Code", DimensionCode);
            Rec.FilterGroup(0);
        end;
    end;

    local procedure SendSpecialCharNotification(InputValue: Text[20])
    var
        SpecialCharNotification: Notification;
    begin
        if HasSpecialFilterChars(InputValue) then begin
            SpecialCharNotification.Scope := NotificationScope::LocalScope;
            SpecialCharNotification.Message := NotificationMsg;
            SpecialCharNotification.Send();
        end;
    end;

    local procedure HasSpecialFilterChars(InputValue: Text[20]): Boolean
    begin
        exit(
            InputValue.Contains('&') or
            InputValue.Contains('|') or
            InputValue.Contains('<') or
            InputValue.Contains('>') or
            InputValue.Contains('=')
            );
    end;

    var
        Emphasize: Boolean;
        NameIndent: Integer;
        NotificationMsg: Label 'The dimension value code contains characters such as &, |, <, >, or = that have special meaning in filters. This may cause unexpected results when the dimension value is used in financial reports, analysis views, or other areas that apply dimension filters. Consider using a code without these characters.';

    local procedure FormatLine()
    begin
        Emphasize := Rec."Dimension Value Type" <> Rec."Dimension Value Type"::Standard;
        NameIndent := Rec.Indentation;
    end;

    [IntegrationEvent(false, false)]
    local procedure OnBeforeOnOpenPage(var DimensionValue: Record "Dimension Value"; var IsHandled: Boolean)
    begin
    end;
}