Skip to main content

Notifications

Business Central forum
Answered

Trigger for Drilldown

Posted on by 41

Hi All,

I'm trying to create a drilldown for my table and page extension that i recently created.

The Table extension is called "Selected Pmts" 

I added this trigger to the Pageextension, but i'm not sure where i went wrong.

Can anyone assist?

pageextension 50103 "Selected Pmts" extends "Bank Account List"
{
layout
{
addafter(BalanceAmt)

field("Selected Pmts"; Rec."Selected Pmts")
            {
                ApplicationArea = all;
                Caption = 'Selected Pmts';
                DrillDown = true;
                 trigger OnDrillDown()
                var
                selpmt: Record "Bank Account"
                begin
                    selpmt."Selected Pmts"(Rec."Selected Pmts");
                    Page.Run(Page:: "Payment Journal");
                end;
                }
                }
                }
                
            

Categories:
  • Rajiv Sewsarran Profile Picture
    Rajiv Sewsarran 41 on at
    RE: Trigger for Drilldown

    resolved with above solution 

  • Rajiv Sewsarran Profile Picture
    Rajiv Sewsarran 41 on at
    RE: Trigger for Drilldown

    Hi Brad,

    This was a great help!

    thanks

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: Trigger for Drilldown

    Hi,

    You have to replace this below line with Setrange and please try to put unique name of each field, variable, pages and functions I can see you are using same name everywhere.

    selpmt."Selected Pmts"(Rec."Selected Pmts");

    Thanks.

  • Verified answer
    Brad_P Profile Picture
    Brad_P 1,542 on at
    RE: Trigger for Drilldown

    I have created a small model which you can follow.

    Added a field to the Customer to count the Open Cust. Ledger Entries:

    field(50100; "BP Open Entry Count"; Integer)
    {
    Caption = 'Open Entry Count';
    Editable = false;
    FieldClass = FlowField;
    CalcFormula = count("Cust. Ledger Entry" WHERE("Customer No." = FIELD("No."), Open = Const(true)));
    }

    On the Customer Card I added the field and a drilldown:

    addlast(General)
    {
    field(BalanceDrillDown; Rec."BP Open Entry Count")
    {
    ApplicationArea = All;
    Caption = 'Drill Down Balance';
    DrillDown = true;

    trigger OnDrillDown()
    var
    CustLedgerEntry: Record "Cust. Ledger Entry";
    begin
    CustLedgerEntry.SetRange("Customer No.", Rec."No.");
    CustLedgerEntry.SetRange(Open, true);
    Page.RunModal(Page::"Customer Ledger Entries", CustLedgerEntry);
    end;

    }
    }

    This should give you enough to go on with your example. I am not clear on your requirements, but you may want to filter the journals a bit more than just a match on No.

    If the flowfield source has a page assigned to it, you do not need to specify the page in the parameter and can use 0.

  • Rajiv Sewsarran Profile Picture
    Rajiv Sewsarran 41 on at
    RE: Trigger for Drilldown

    Clcl.PNG

  • Rajiv Sewsarran Profile Picture
    Rajiv Sewsarran 41 on at
    RE: Trigger for Drilldown

    Apologies,

    Here it is

               CalcFormula = Sum("Gen. Journal Line".Amount WHERE("Bal. Account No." = FIELD("No.")));

  • Rajiv Sewsarran Profile Picture
    Rajiv Sewsarran 41 on at
    RE: Trigger for Drilldown

    sorry im not sure i follow

  • Brad_P Profile Picture
    Brad_P 1,542 on at
    RE: Trigger for Drilldown

    This is not the calcformula property on the field that you had added.

  • Rajiv Sewsarran Profile Picture
    Rajiv Sewsarran 41 on at
    RE: Trigger for Drilldown

    HI Brad,

    Here's the calcformula

    procedure GetProjBal(): Decimal

       begin

           CalcFields(Balance, "Selected Pmts");

           exit(Rec.Balance - Rec."Selected Pmts");

       end;

  • Brad_P Profile Picture
    Brad_P 1,542 on at
    RE: Trigger for Drilldown

    What is the CalcFormula properties on the field that you added?

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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans