I have created a report in which Comments have to be displayed for corresponding employees in a particular date range.
The issue is that, whenever I mention the wrong duration of date (i.e. the date range in which there are no comments registered) then, some of the headers in the report (those which are mentioned in the dataitems) do not appear in the report.
Is there any way to display all the headers even if there is no data appearing in the report ?
report 50104 EmployeeComments
{
Caption = 'Comments';
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
DefaultLayout = RDLC;
RDLCLayout = 'EmployeeComments.rdl';
dataset
{
dataitem(Employee1; Employee)
{
RequestFilterFields = "No.", "Office Location", "Status";
PrintOnlyIfDetail = true;
// DataItemTableView = where ("Table Name" = filter (Employee));
dataitem("Human Resource Comment Line"; "Human Resource Comment Line")
{
DataItemLink = "No." = field ("No.");
RequestFilterFields = Comment_Type;
column(FORMAT_TODAY_0_4_; Format(Today, 0, 4))
{
}
column(COMPANYNAME; COMPANYPROPERTY.DisplayName)
{
}
// column(CurrReport_PAGENO; CurrReport.PageNo)
// {
// }
column(No_; "No.")
{
}
column(EmpFirstName; EmpFirstName)
{
}
column(EmpLastName; EmpLastName)
{
}
column(EmpLoc; Employee."Office Location")
{
}
column(Comment_Type; Comment_Type)
{
}
column(Date; format(Date))
{
}
column(Comment; Comment)
{
}
column(NoFilter; NoFilter)
{
}
column(CommentTypeFilter; CommentTypeFilter)
{
}
column(CommentDateFromFilter; CommentDateFromFilter)
{
}
column(EmployeeFilter; EmployeeFilter)
{
}
column(HumanResourceCommentLineFilter; HumanResourceCommentLineFilter)
{
}
// dataitem(Employee; Employee)
// {
// RequestFilterHeading = '';
// RequestFilterFields = "Office Location", "Status";
// DataItemLinkReference = "Human Resource Comment Line";
// DataItemLink = "No." = field ("No.");
// }
trigger OnPreDataItem()
var
myInt: Integer;
begin
SetRange(Date, CommentDateFrom, CommentDateTo);
EmployeeFilter := Employee1.GetFilters;
HumanResourceCommentLineFilter := "Human Resource Comment Line".GetFilters;
end;
trigger OnAfterGetRecord()
begin
// IF (CommentDateFrom <> 0D) and (CommentDateTo <> 0D) then begin
// SetRange(Date, CommentDateFrom, CommentDateTo);
// end;
Clear(EmpFirstName);
Clear(EmpLastName);
Clear(EmpLoc);
if Employee.Get("No.") then begin
EmpFirstName := Employee."First Name";
EmpLastName := Employee."Last Name";
EmpLoc := Employee."Office Location";
end;
//SetRange(Date, CommentDateFrom, CommentDateTo);
end;
}
}
}
requestpage
{
layout
{
area(Content)
{
field("Comment Date From"; CommentDateFrom)
{
ApplicationArea = all;
ShowMandatory = true;
// trigger OnValidate()
// var
// myInt: Integer;
// begin
// if Format(CommentDateFrom) = ' ' then begin
// Error('Value required');
// end;
// end;
}
field("Comment Date To"; CommentDateTo)
{
ApplicationArea = all;
ShowMandatory = true;
}
}
}
trigger Onopenpage() //sets default value for the Status filter as 'Active'
var
myInt: Integer;
begin
Employee1.SetRange(Status, Employee1.Status::Active);
end;
}
// trigger OnPreReport()
// var
// myInt: Integer;
// begin
// NoFilter := Employee.GetFilters;
// CommentTypeFilter := "Human Resource Comment Line".GetFilters;
// CommentDateFromFilter := "Human Resource Comment Line".GetFilters;
// end;
trigger OnPreReport() //making start and end dates mandatory
var
myInt: Integer;
begin
if (CommentDateFrom = 0D) OR (CommentDateTo = 0D) then begin
Error('Start date and End date is mandatory');
end;
end;
var
CurrReport_PAGENOCaptionLbl: Label 'Page';
CommentDateFrom: Date;
CommentDateTo: Date;
HumanResource: Record "Human Resource Comment Line";
Employee: Record Employee;
EmpFirstName: Text;
EmpLastName: Text;
EmpLoc: Code[50];
NoFilter: Text;
CommentTypeFilter: Text;
CommentDateFromFilter: Text;
EmployeeFilter: Text;
HumanResourceCommentLineFilter: Text;
status: Text;
commentType: Code[50];
}