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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Reports groups in Business central

(0) ShareShare
ReportReport
Posted on by 305

Hi

I have a report in which I need to group the records on the basis of Employee No. I have a problem in the report such that two columns 'Department' and 'Office Location' from Employee dataitem displays the values tagged with the first employee of the report for all the other employees as well. These should however be corresponding to each employee. Below is the code: 

report 50109 "Employee - Staff Absence"
{
    // version NAVW113.00,NAVNA13.00

    DefaultLayout = RDLC;
    RDLCLayout = './Employee - Staff Absences.rdl';
    ApplicationArea = All;
    Caption = 'Staff Absences';
    UsageCategory = ReportsAndAnalysis;

    dataset
    {
        dataitem(Employee1; Employee)
        {
            RequestFilterFields = "Office Location", "Status", "Department";
            // DataItemLink = "No." = field("Employee No.");
            PrintOnlyIfDetail = true;



            dataitem("Employee Absence"; "Employee Absence")
            {
                DataItemTableView = SORTING("Employee No.", "From Date");
                DataItemLink = "Employee No." = field("No.");
                RequestFilterFields = "Employee No.", "From Date", "Cause of Absence Code";

                //  dataitem(Employee1; Employee)
                // {
                //      RequestFilterFields = "Office Location", "Status", "Department";
                //      DataItemLink = "No." = field("Employee No.");

                column(FORMAT_TODAY_0_4_; Format(Today, 04))
                {
                }
                column(COMPANYNAME; COMPANYPROPERTY.DisplayName)
                {
                }
                column(CurrReport_PAGENO; CurrReport.PageNo)
                {
                }
                column(Employee_Absence__TABLECAPTION__________AbsenceFilter; TableCaption + ': ' + AbsenceFilter)
                {
                }
                column(AbsenceFilter; AbsenceFilter)
                {
                }
                column(EmployeeFilter; EmployeeFilter)
                {
                }
                column(Employee_Absence__Employee_No__; "Employee Absence"."Employee No.")
                {
                }
                column(Employee_FullName; Employee.FullName)
                {
                }
                column(Employee_Absence__From_Date_; Format("Employee Absence"."From Date"))
                {
                }
                column(Employee_Absence__To_Date_; Format("Employee Absence"."To Date"))
                {
                }
                column(Employee_Absence__Cause_of_Absence_Code_; "Employee Absence"."Cause of Absence Code")
                {
                }
                column(Employee_Absence_Description; "Employee Absence".Description)
                {
                }
                column(Employee_Absence_Quantity; "Employee Absence".Quantity)
                {
                }
                column(Employee_Absence__Unit_of_Measure_Code_; "Employee Absence"."Unit of Measure Code")
                {
                }
                column(Employee___Staff_AbsencesCaption; Employee___Staff_AbsencesCaptionLbl)
                {
                }
                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__Cause_of_Absence_Code_Caption; FieldCaption("Cause of Absence Code"))
                {
                }
                column(Employee_Absence_DescriptionCaption; FieldCaption(Description))
                {
                }
                column(Employee_Absence_QuantityCaption; FieldCaption(Quantity))
                {
                }
                column(Employee_Absence__Unit_of_Measure_Code_Caption; FieldCaption("Unit of Measure Code"))
                {
                }
                column(Office_Location; Employee1."Office Location")
                {

                }
                column(Department; Employee1.Department)
                {

                }

                trigger OnAfterGetRecord()
                begin
                    Employee.Get("Employee No.");
                    // Clear(EmpLoc);
                    // Clear(EmpDep);
                    // if Employee.Get("Employee No.") then begin
                    //     // EmpLoc := Employee."Office Location";
                    //     EmpDep := format(Employee.Department);
                    // 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
        AbsenceFilter := "Employee Absence".GetFilters;
        EmployeeFilter := Employee1.GetFilters;
    end;

    var
        Employee: Record Employee;
        AbsenceFilter: Text;
        EmployeeFilter: Text;
        Employee___Staff_AbsencesCaptionLbl: Label 'Employee - Staff Absences';
        CurrReport_PAGENOCaptionLbl: Label 'Page';
        Employee_Absence__From_Date_CaptionLbl: Label 'From Date';
        Employee_Absence__To_Date_CaptionLbl: Label 'To Date';

}


Please help.
Regards,
Khudeja
I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans