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;