web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Field Value from Different table to another page- AL Code

(0) ShareShare
ReportReport
Posted on by 224

Dear Experts,

am Entirely new to BC and AL coding, Couple of days only i started on BC and Development Learning  

Right now am trying to bring two fields (Document No, & Description) from table (G/L Entry table - 26) to another page "Analysis View Entries" (Analysis View Entry (365)). once we click on amount in Analysis View Entries, it goes to corresponding GL entries .

i don't know whether i made code correct or not to achieve this result. 

I kindly request experts help to fix the issue

1Analysisview-entry.JPG

2glentry.JPG

pageextension 60004 PageExtension50002 extends "Analysis View Entries"
{
    layout
    {
        addafter("Dimension 1 Value Code")
        {

            field("Document No"; DocumentNo)
            {
                ApplicationArea = All;
                Caption = 'Document No';

            }
            field ("Description"; Description)
            {
                ApplicationArea = All;
                
            }

        }
    }
    trigger OnAfterGetRecord();
    var
        GenLedEntry: Record "G/L Entry";


    begin
        Clear(DocumentNo);
        GenLedEntry.Reset();
        GenLedEntry.Get(Rec."Dimension 1 Value Code");
        DocumentNo := GenLedEntry."Document No.";
        Description := GenLedEntry.Description;


    end;

    var
        DocumentNo: Code[20];
        Description : Text[100];
}



Regards

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Field Value from Different table to another page- AL Code

    Hi LearnBC ,

    Please change below line of code into your code, and check again.


    GenLedEntry.Get(Rec."Entry No.");

    Let me know if it works.

  • LearnBC Profile Picture
    224 on at
    RE: Field Value from Different table to another page- AL Code

    No, after changing the code as you said am getting the Error like this

    GLEror.JPG

    .

    Changed Code

    pageextension 60004 PageExtension50002 extends "Analysis View Entries"
    {
        layout
        {
            addafter("Dimension 1 Value Code")
            {
    
                field("Document No"; DocumentNo)
                {
                    ApplicationArea = All;
                    Caption = 'Document No';
    
                }
                field("Description"; Description)
                {
                    ApplicationArea = All;
    
                }
    
            }
        }
        trigger OnAfterGetRecord();
        var
            GenLedEntry: Record "G/L Entry";
    
    
        begin
            Clear(DocumentNo);
            GenLedEntry.Reset();
            //GenLedEntry.Get(Rec."Dimension 1 Value Code");
            GenLedEntry.Get(Rec."Entry No.");
            DocumentNo := GenLedEntry."Document No.";
            Description := GenLedEntry.Description;
    
    
        end;
    
        var
            DocumentNo: Code[20];
            Description: Text[100];
    }
    

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Field Value from Different table to another page- AL Code

    Hi,

    Please try this now.

    begin

           Clear(DocumentNo);

           clear(Description);

           GenLedEntry.Reset();

           //GenLedEntry.Get(Rec."Dimension 1 Value Code");

           if GenLedEntry.Get(Rec."Entry No.") then

          begin

           DocumentNo := GenLedEntry."Document No.";

           Description := GenLedEntry.Description;

         end;

       end;

  • LearnBC Profile Picture
    224 on at
    RE: Field Value from Different table to another page- AL Code

    After changing like this, both fields are came. but corresponding values are not coming over there

    Code after Suggested Modfication

    pageextension 60004 PageExtension50002 extends "Analysis View Entries"
    {
        layout
        {
            addafter("Dimension 1 Value Code")
            {
    
                field("Document No"; DocumentNo)
                {
                    ApplicationArea = All;
                    Caption = 'Document No';
    
                }
                field("Description"; Description)
                {
                    ApplicationArea = All;
    
                }
    
            }
        }
        trigger OnAfterGetRecord();
        var
            GenLedEntry: Record "G/L Entry";
    
        begin
    
            Clear(DocumentNo);
    
            clear(Description);
    
            GenLedEntry.Reset();
    
            //GenLedEntry.Get(Rec."Dimension 1 Value Code");
    
            if GenLedEntry.Get(Rec."Entry No.") then begin
    
                DocumentNo := GenLedEntry."Document No.";
    
                Description := GenLedEntry.Description;
    
            end;
    
        end;
    
        // begin
        //     Clear(DocumentNo);
        //     GenLedEntry.Reset();
        //     //GenLedEntry.Get(Rec."Dimension 1 Value Code");
        //     GenLedEntry.Get(Rec."Entry No.");
        //     DocumentNo := GenLedEntry."Document No.";
        //     Description := GenLedEntry.Description;
    
    
        // end;
    
        var
            DocumentNo: Code[20];
            Description: Text[100];
    }
    

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Field Value from Different table to another page- AL Code

    Hi,

    Can you please check if the corresponding Analysis view entry record has "Entry No."?

    Thanks.

  • LearnBC Profile Picture
    224 on at
    RE: Field Value from Different table to another page- AL Code

    Hello.

    Entry field dont have any value in Analaysis view. in GL/Entry table there is value for that.

    as per my understanding, it is matched with Employee code. (Employee code is coming over Dimension value 1-first screenshot mentioned)

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: Field Value from Different table to another page- AL Code

    In that case please use below

    GenLedEntry.Reset();

           //GenLedEntry.Get(Rec."Dimension 1 Value Code");

           // if GenLedEntry.Get(Rec."Entry No.") then begin

    GenLedEntry.setrange("Posting Date",rec."Posting Date");

    GenLedEntry.setrange("Dimension 1 Value Code",rec."Dimension 1 Value Code")

    if GenLedEntry.findfirst then

    begin

               DocumentNo := GenLedEntry."Document No.";

               Description := GenLedEntry.Description;

           end;

  • LearnBC Profile Picture
    224 on at
    RE: Field Value from Different table to another page- AL Code

    Thanks for you time and support.

    But still now values are not coming over the page.

    6136.GLEror.JPG

  • Suggested answer
    Umang Srivastava Profile Picture
    100 on at
    RE: Field Value from Different table to another page- AL Code

    Hi Kindly try this code.

    pageextension 60004 PageExtension50002 extends "Analysis View Entries"
    {
    layout
    {
    addafter("Dimension 1 Value Code")
    {

    field("Document No"; GenLedEntry."Document No.";)
    {
    ApplicationArea = All;
    Caption = 'Document No';

    }
    field ("Description";GenLedEntry."Description";)
    {
    ApplicationArea = All;

    }

    }
    }
    trigger OnAfterGetCurrRecord();


    begin
    GenLedEntry.Get(Rec."Entry No.");
    end;

    var
    GenLedEntry: Record "G/L Entry";
    }

  • LearnBC Profile Picture
    224 on at
    RE: Field Value from Different table to another page- AL Code

    Thanks for your reply.

    After  updating the last code am getting the Below Error. GL entry field issue. 

    GlError1.JPG

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,901

#2
YUN ZHU Profile Picture

YUN ZHU 2,079 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 2,041

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans