Skip to main content

Notifications

Small and medium business | Business Central, N...
Unanswered

Worksheet page fields of matrix[1] ....are not getting updated

Posted on by 208
I have a requirement where a worksheet page with a listplus needs to be populated on basis of year selected on headers. Say , we have mentioned 2024 as start and 2034 as end then, boolean data in listplus should get populated on basis of year selected as tue and false but it is not geeting updated.

If i use OnaftergetRecord on listplus then only it is getting updated but i want to call Onaftergetrecord once filter is selected on worksheet page but this approach is not working.
 field(Period; Period)
                {
                    ToolTip = 'Specifies the value of the period field.';
                    Caption = 'Period';
 
                    trigger OnValidate()
                    var
                        LeaseInfoRec: Record /ADT-Lease Information/;
                        MATRIX_CurrentColumnOrdinal: Integer;
                        avaliablitymatrixpage: Page /Avaliablity Matrix/;
                    begin
                        if LeaseInfoRec.FindSet() then
                            repeat
                                for MATRIX_CurrentColumnOrdinal := 1 to 12 do begin
                                    avaliablitymatrixpage.UpdateData(Period, MATRIX_CurrentColumnOrdinal, LeaseInfoRec);
                                end;
 
                            until LeaseInfoRec.Next() = 0;
                    end;
 
                }

    procedure UpdateData(Period: Enum /Day Filter/; ColumnID: Integer; LeaseInfoRec: Record /ADT-Lease Information/)
    var
        TempItem: Record /ADT-Lease Information/ temporary;
        Startdate: Date;
        Enddate: Date;
        NewCaption: Text[80];
        CaptionDate: Date;
        Month: Integer;
        Year: Integer;
        StartMonth: Integer;
        EndMonth: Integer;
        StartYear: Integer;
        EndYear: Integer;
    begin
 
        rec.get(LeaseInfoRec.Number);      
        TempItem.Copy(rec);
 
        Startdate := TempItem.LeaseCommencementDate;
        Enddate := TempItem.LeaseCommencementEndDate;
 
        StartMonth := Date2DMY(Startdate, 2);
        EndMonth := Date2DMY(Enddate, 2);
        StartYear := Date2DMY(Startdate, 3);
        EndYear := Date2DMY(Enddate, 3);
 
        case Period of
            Period::Day:
                begin
                    // Handle Day calculations
                end;
            Period::Month:
                begin
                    Month := ColumnID; // Set the month based on the ColumnID
                    Year := 2024; // Set the year to 2024
                    NewCaption := Format(DMY2Date(1, Month, Year), 0, '<Month,2>/<Year4>');
                    CaptionDate := DMY2Date(1, Month, Year);
                end;
            Period::Year:
                begin
                    Year := Date2DMY(TempItem.LeaseCommencementDate, 3) + ColumnID - 1;
                    NewCaption := Format(DMY2Date(1, 1, Year), 0, '<Year4>');
                    CaptionDate := DMY2Date(1, 1, Year);
                end;
        end;
 
        MATRIX_CaptionSet[ColumnID] := NewCaption;
 
        if (Startdate <= CaptionDate) and (CaptionDate <= Enddate) then
            MATRIX_CellData[ColumnID] := true
        else
            MATRIX_CellData[ColumnID] := false;
 
        Rec.Modify();
        CurrPage.Update();
    end;
Categories:

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,113 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans