web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Display headers in report

(0) ShareShare
ReportReport
Posted on by 700

Hi All,

In the attached report, I have to display all the headers (not column names), such as Date, Company Name, Filters applied etc. even when there is no data in the report. How to achieve this ?

For example, when I apply the 'Status' filter as Active and there is data present for this filter then the report is working fine. But when  I apply the 'Status' filter as Inactive and there is no data present for this filter, then some headers disappear (such as Company Name, Date and Filters Applied).

I am attaching the source code for reference.

Thanks !

Please help as soon as possible, it's urgent.

report 50107 "Employee-Absences by Details"
{

    RDLCLayout = './Employee - Absences by Details.rdl';
    ApplicationArea = All;
    Caption = 'Absences by Details';
    UsageCategory = ReportsAndAnalysis;

    dataset
    {

        dataitem(Employee1; Employee)
        {
            DataItemTableView = sorting("No.");
            RequestFilterFields = "Location", "Status", "Department";
            // column(FORMAT_TODAY_0_4_; Format(Today, 0, 4))
            // {
            // }
            // column(COMPANYNAME; COMPANYPROPERTY.DisplayName)
            // {
            // }
            // column(EmployeeFilter; EmployeeFilter)
            // {
            // }
            // column(EmployeeAbsenceFilter; EmployeeAbsenceFilter)
            // {
            // }
            dataitem("Employee Absence"; "Employee Absence")
            {
                DataItemLink = "Employee No." = field("No.");
                DataItemTableView = SORTING("Cause of Absence Code", "From Date");
                RequestFilterFields = "Employee No.", "From Date", "Cause of Absence Code";
                column(FORMAT_TODAY_0_4_; Format(Today, 0, 4))
                {
                }
                column(COMPANYNAME; COMPANYPROPERTY.DisplayName)
                {
                }
                // column(CurrReport_PAGENO; CurrReport.PageNo)
                // {
                // }

                column(Employee_Absence_Description; Description)
                {
                }
                column(Employee_Absence__Cause_of_Absence_Code_; "Cause of Absence Code")
                {
                }
                column(Employee_Absence__From_Date_; Format("From Date"))
                {
                }
                column(Employee_Absence__To_Date_; Format("To Date"))
                {
                }
                column(Employee_Absence__Quantity__Base__; "Quantity (Base)")
                {
                }
                column(HumanResSetup__Base_Unit_of_Measure_; HumanResSetup."Base Unit of Measure")
                {
                }
                column(Employee_Absence__Employee_No__; "Employee No.")
                {
                }
                column(Employee_FullName; Employee.FullName)
                {
                }
                column(Employee_FirstName; Employee."First Name")
                {
                }
                column(Employee_Surname; Employee."Last Name")
                {
                }
                column(TotalAbsence; TotalAbsence)
                {
                    DecimalPlaces = 0 : 2;
                }
                column(Employee___Absences_by_CausesCaption; Employee___Absences_by_CausesCaptionLbl)
                {
                }
                column(CurrReport_PAGENOCaption; CurrReport_PAGENOCaptionLbl)
                {
                }
                column(Employee_Absence__From_Date_Caption; Employee_Absence__From_Date_CaptionLbl)
                {
                }
                column(Employee_Absence__To_Date_Caption; Employee_Absence__To_Date_CaptionLbl)
                {
                }
                column(Employee_Absence__Employee_No__Caption; FieldCaption("Employee No."))
                {
                }

                column(Employee_Absence__Quantity__Base__Caption; FieldCaption("Quantity (Base)"))
                {
                }

                column(Employee_EmpDate; format(Employee."Employment Date"))
                {
                }
                column(DaysAbsent; DaysAbsent)
                {
                }
                // column(Emp_Department; Emp_Department)
                // {
                // }
                column(Emp_Department; Employee.Department)
                {

                }
                column(AbsenceDescription; AbsenceDescription)
                {
                }
                column(Quantity; Quantity)
                {
                }
                column(EmployeeFilter; EmployeeFilter)
                {
                }
                column(EmployeeAbsenceFilter; EmployeeAbsenceFilter)
                {
                }

                trigger OnPreDataItem()
                begin
                    EmployeeFilter := Employee1.GetFilters();
                    EmployeeAbsenceFilter := "Employee Absence".GetFilters();
                end;

                trigger OnAfterGetRecord()
                begin
                    Clear(Emp_Department);
                    Clear(AbsenceDescription);
                    Employee.Get("Employee No.");
                    TotalAbsence := TotalAbsence   "Quantity (Base)";
                    DefaultDimension.Reset();
                    DefaultDimension.SetRange("Table ID", 5200);
                    DefaultDimension.SetRange("Dimension Code", 'DEPARTMENT');
                    DefaultDimension.SetRange("No.", "Employee No.");
                    IF DefaultDimension.Findset() then begin

                        Emp_Department := DefaultDimension."Dimension Value Code";
                    END;
                    CauseofAbsenceRec.Reset();
                    CauseofAbsenceRec.SetRange(Code, "Cause of Absence Code");
                    IF CauseofAbsenceRec.FindFirst() then begin
                        AbsenceDescription := CauseofAbsenceRec.Description;
                    end;

                end;


            }
        }
    }

    requestpage
    {

        layout
        {
        }
        trigger Onopenpage()               //sets default value for the Status filter as 'Active'
        var
            myInt: Integer;
        begin
            Employee1.SetRange(Status, Employee1.Status::Active);
        end;

        // actions
        // {
        // }
    }

    labels
    {
    }

    // trigger OnPreReport()
    // begin
    //     LocationFilter := Employee.GetFilters;
    //     EmployeeNoFilter := "Employee Absence".GetFilters;
    //     EmployeeAbsenceFilter := "Employee Absence".GetFilters;
    //     HumanResSetup.Get;
    //     HumanResSetup.TestField("Base Unit of Measure");
    // end;

    var
        Employee: Record Employee;
        CauseofAbsenceRec: Record "Cause of Absence";
        Emp_Department: Code[30];
        AbsenceDescription: Text;
        DefaultDimension: Record "Default Dimension";
        HumanResSetup: Record "Human Resources Setup";
        TotalAbsence: Decimal;
        Employee___Absences_by_CausesCaptionLbl: Label 'Employee - Absences by Causes';
        CurrReport_PAGENOCaptionLbl: Label 'Page';
        Employee_Absence__From_Date_CaptionLbl: Label 'From Date';
        Employee_Absence__To_Date_CaptionLbl: Label 'To Date';
        Full_NameCaptionLbl: Label 'Full Name';
        HumanResSetup__Base_Unit_of_Measure_CaptionLbl: Label 'Base Unit of Measure';
        Total_AbsenceCaptionLbl: Label 'Total Absence';
        DaysAbsent: Integer;
        EmployeeFilter: Text;
        EmployeeAbsenceFilter: Text;
}


  • ManishS Profile Picture
    86 on at

    Take Company as first data item.

  • Suggested answer
    Olister Rumao Profile Picture
    4,009 on at

    Hi,

    Add a Dataitem which is outside the Employee Dataitem.

    All the fields that you require irrespective of the Employee filters and put them as columns for the created DataItem.

    Create a trigger such as OnAfterGetRecord for the created DataItem to compute the values for columns.

  • Dynamics 365 Business Central Profile Picture
    700 on at

    Can you design the code accordingly, if possible. I tried, but I think I am making some mistakes

  • Dynamics 365 Business Central Profile Picture
    700 on at

    In this case, the resulting report contains some blank space for the new added dataitem. How to remove that empty space ?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 768 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 541 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 324 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans