Filter from date to date Query SSRS X++


        _periodFromDate= _dataContract.parmperiodFromDate();
        _periodToDate= _dataContract.parmPeriodToDate();
         
         
        queryBuildDataSource = query.dataSourceTable(tablenum(LedgerJournalTrans));

        if(_periodFromDate)
        {
            queryBuildRange = queryBuildDataSource.findRange(fieldnum(LedgerJournalTrans, TransDate));
            if (!queryBuildRange)
            {
                queryBuildRange = queryBuildDataSource.addRange(fieldnum(LedgerJournalTrans, TransDate));
            }
            // If an account number has not been set, then use the parameter value to set it.
            if(!queryBuildRange.value())
                queryBuildRange.value(queryRange(_periodFromDate,today()));
            queryBuildRange.value(SysQuery::range(_periodFromDate, dateNull()));

        }

        if(_periodToDate)
        {
            queryBuildRange = queryBuildDataSource.findRange(fieldnum(LedgerJournalTrans, TransDate));
            if (!queryBuildRange)
            {
                queryBuildRange = queryBuildDataSource.addRange(fieldnum(LedgerJournalTrans, TransDate));
            }
            // If an account number has not been set, then use the parameter value to set it.
            if(!queryBuildRange.value())
                queryBuildRange.value(SysQuery::range(dateNull(), _periodToDate));
 
        }

Leave Comment

Your email address will not be published. Required fields are marked *