Results 1 to 9 of 9

Thread: HELP: Filter Function

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    Jun 2016
    Point Cook, Victoria, Australia

    Default Re: HELP: Filter Function


    This is all the code and if you read the comments contained therein, it explains at exactly what point the dates are "deregionalised" into miltary dates:

    Procedure SetFilters
        String sReportId
        String[] sClientIDs
        String[] sTripTmpStartDates
        // Dates are turned into military dates when DateToString or AddFilter manages dates,
        //  so add more variables here and store the dates after WebGet. This fixes
        //  the problem and keeps them to whatever the regional settings are.
        // Note to self - find out which one is the culprit ...
        String sFromDate sToDate
        Get psReportId to sReportId
        WebGet psValue of oFromClientID to sClientIDs[0]
        WebGet psValue of oToClientID to sClientIDs[1]
        If (sClientIDs[0] <> 0) Begin
            Send AddFilter sReportId "{Client.ID}" C_drGreaterThanOrEqual sClientIDs[0]
        If (sClientIDs[1] <> 0) Begin
            Send AddFilter sReportId "{Client.ID}" C_drLessThanOrEqual sClientIDs[1]
        WebGet psValue of oFromTripTmpStartDate to sTripTmpStartDates[0]
        WebGet psValue of oToTripTmpStartDate to sTripTmpStartDates[1]
        // For SetSelectionCriteria - refer above notes.
        Move sTripTmpStartDates[0] to sFromDate
        Move sTripTmpStartDates[1] to sToDate
        If (Not (IsNullDateTime (sTripTmpStartDates[0]))) Begin
           Get DateToString of oReport sTripTmpStartDates[0] to sTripTmpStartDates[0]
           Send AddFilter sReportId "{TripTmp.StartDate}" C_drGreaterThanOrEqual sTripTmpStartDates[0]
        If (Not (IsNullDateTime (sTripTmpStartDates[1]))) Begin
           Get DateToString of oReport sTripTmpStartDates[1] to sTripTmpStartDates[1]
           Send AddFilter sReportId "{TripTmp.StartDate}" C_drLessThanOrEqual sTripTmpStartDates[1]
        Send SetSelectionCriteria sReportId sClientIDs[0] sClientIDs[1] sFromDate sToDate
    Procedure SetSelectionCriteria String sReportId String sFromId String sToId String sFromDate String sToDate
        String   sSelectionCriteria
        Integer  iParameter
        // Apply some filtering here if some of the criteria is blank. Work in progress … RW 20190815
        Move ("Id: From " + sFromId + " To " + sToId + " - Date: From " + sFromDate + " To " + sTodate) to sSelectionCriteria
        Get ParameterIdByName sReportId "SelectionCriteria"    to iParameter
        If (iParameter <> -1) ;
        Set psParameterValue  sReportId iParameter             to sSelectionCriteria
        Else ;
        Send UserError "Admin msg: DR Parameter 'SelectionCriteria' does not exist in report." "Information"
    Last edited by Rachael; 16-Aug-2019 at 03:26 PM.
    Rachael Warlond

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts