Hi All
I'm trying to generate a report that reads from a temporary table. However, the temporary table should be populated from a Query when a user runs the report. So far no data pulls through (empty error).
I have used pattern from Dynamics 365 Business Central: Using the query as a data source for a page (Query.Open Method) | Dynamics 365 Lab (yzhums.com)
So far this is my code and I have tried triggers predataItem and onaftergetrecord:
column(Lot; Lot) { }
column(Serial; Serial) { }
trigger OnPreDataItem()
var
LotByBinTemp: Record LotByBinTemp;
LotByBinQuery: Query LotNumbersbyBin;
begin
LotByBinTemp.DeleteAll();
if LotByBinQuery.Open() then begin
while LotByBinQuery.Read() do begin
LotByBinTemp.Init();
LotByBinTemp.RowNo := LotByBinTemp.RowNo 1;
LotByBinTemp.Location := LotByBinQuery.Location_Code;
LotByBinTemp.ItemNo := LotByBinQuery.Item_No;
LotByBinTemp.Lot := LotByBinQuery.Lot_No;
LotByBinTemp.Serial := LotByBinQuery.Serial_No;
LotByBinTemp.Insert();
end;
LotByBinQuery.Close();
end;
End;