Hello, I just started coding with AL for Business Central. I am trying to make a simple report that references the Sales Header and provides me with Order Intake based off of the SystemCreatedAt date and time. I got my code to the point where there are no syntax errors and it has published successfully. I am having an issue with after the code is published, it is not showing up in the search bar in business central. From my understanding, all you need to define for the report to show up is 'UsageCategory' which I have set to 'ReportsAndAnalysis'. Can someone please let me know if I am missing something in my code or if something just seems completely wrong?
// Order Intake Report Page
report 50100 /Order Intake/
{
// The usage category makes the report available in the search
UsageCategory = ReportsAndAnalysis;
// This is where we define the layout of the report
RDLCLayout = './ReportLayout.rdlc';
dataset
{
// DataItem to hold Sales Header data
dataitem(SalesHeader; /Sales Header/)
{
// Filter to only include Sales Orders
DataItemTableView = SORTING(/Document Type/) WHERE(/Document Type/ = CONST(Order));
// Columns to display in the report
column(DocumentNo; /No./)
{
IncludeCaption = true;
}
column(SellToCustomerName; /Sell-to Customer Name/)
{
IncludeCaption = true;
}
column(SellToCustomerNo; /Sell-to Customer No./)
{
IncludeCaption = true;
}
column(TotalAmount; /Amount Including VAT/)
{
IncludeCaption = true;
}
column(CreatedAt; /SystemCreatedAt/)
{
IncludeCaption = true;
}
}
}
// Request page for the report, allowing the user to filter by the Created At date
requestpage
{
layout
{
area(content)
{
group(GroupName)
{
field(DateFilterFrom; DateFilterFrom)
{
ApplicationArea = All;
Caption = 'Created Date From';
ToolTip = 'Enter the start date to filter the Sales Orders.';
}
field(DateFilterTo; DateFilterTo)
{
ApplicationArea = All;
Caption = 'Created Date To';
ToolTip = 'Enter the end date to filter the Sales Orders.';
}
}
}
}
}
trigger OnPreReport()
begin
// Apply the date filter before the report is generated
if DateFilterFrom <> 0DT then
SalesHeader.SetRange(/SystemCreatedAt/, DateFilterFrom, DateFilterTo);
end;
var
DateFilterFrom: DateTime;
DateFilterTo: DateTime;
}

Report
All responses (
Answers (