Date Filter on report

Hi All,

I have created a report in which birthdays of employees are displayed within specified date range entered bu user.

When I provide Start Date and End Date both on the request page, then report shows correct data.

But when End Date is left blank then the birthdays falling before the Start Date are also getting displayed.

Requirement is that, when Start Date is specified and End Date is left blank then report should display birthdays coming after the Start Date.

Please provide a solution to this issue.

Source Code is also attached.

report 50101 EmployeeBirthdayReport
{
    Caption = 'Birthday';
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;
    DefaultLayout = RDLC;
    RDLCLayout = 'EmployeeBirthdayReport.rdl';

    dataset
    {
        dataitem("General Ledger Setup"; "General Ledger Setup")
        {
            DataItemTableView = sorting("Primary Key");
            // PrintOnlyIfDetail = true;
            column(FORMAT_TODAY_0_4_; Format(Today, 0, 4)) { }
            column(COMPANYNAME; COMPANYPROPERTY.DisplayName) { }
            column(EmployeeFilter; EmployeeFilter) { }

            trigger OnAfterGetRecord()
            var
                myInt: Integer;
            begin
                EmployeeFilter := Employee.GetFilters;
            end;

        }
        dataitem("Employee"; Employee)
        {
            RequestFilterHeading = ' ';
            RequestFilterFields = "Office Location", "Status";



            // column(CurrReport_PAGENO; CurrReport.PageNo)
            // {
            // }
            column(No_; "No.")
            {

            }

            column(First_Name; "First Name")
            {

            }
            column(Last_Name; "Last Name")
            {

            }
            column(Birth_Date; format("Birth Date"))
            {

            }


            trigger OnPreDataItem()
            var
                myInt: Integer;
            begin
                If (FromDate > 0D) and (ToDate > 0D) then
                   

                    SetRange(EmpBirthDayNew, FromDate, ToDate);

               
            end;

          
        }
    }
    requestpage

    {


        layout

        {

            area(Content)

            {

                field("From Date"; FromDate)

                {
                    ApplicationArea = All;
                }

                field("To Date"; ToDate)
                {
                    ApplicationArea = ALL;
                }

            }

        }

        trigger Onopenpage()              //sets default value for the Status filter as 'Active'
        var
            myInt: Integer;
        begin
            Employee.SetRange(Status, Employee.Status::Active);
            //Employee.SetRange("Birth Date", FromDate, ToDate);
        end;


    }


    var

        CurrReport_PAGENOCaptionLbl: Label 'Page';
        FromDate: Date;
        ToDate: Date;
        EmployeeFilter: Text;

}

Thanks !

Related
Recommended