AnsweredAssumed Answered

Simple Custom Dialog to get date range for reports

Question asked by skashanchi on Jul 29, 2015
Latest reply on Jul 29, 2015 by skashanchi

Title

Simple Custom Dialog to get date range for reports

Post

I have created a report that requires the records to be restricted based on a starting and ending date range. The report itself works fine, but right now the date range is hard coded in the layout script for the report, so I have to go in and manually change the dates every week. So I wanted to open up a custom dialog that would ask the user for the "From" and "To" dates and then pass those parameters to my report.

Seems like it should be very easy, but I am getting errors every time I run the script. I am not sure I am doing this the best way, but what I am doing seems like it should work fine, so I am confused.

The script for the report is this:

         
  1. Show Custom Dialog [ Title: "Report Date Range"; Message: "Please enter the desired date range for the report:"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “Yes”; Input #1: Trips::REPDateFrom, "From"; Input #2: Trips::REPDateTo, "To" ]
  2.      
  3. Set Variable [ $$REPDateFrom; Value:Trips::REPDateFrom ]
  4.      
  5. Set Variable [ $$REPDateTo; Value:Trips::REPDateTo ]
  6.      
  7. Enter Browse Mode [ ]
  8.      
  9. Go to Layout [ “Trips HCBS” (Trips) ]
  10.      
  11. #Restrict Basd on Funding Source
  12.      
  13. Perform Find [ Specified Find Requests: Find Records; Criteria: Trips::TripFunding: “==HCBS” ] [ Restore ]
  14.      
  15. #Restrict Based on Trip Date Start
  16.      
  17. Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Trips::TripDate: “>=$$REPDateFrom” ] [ Restore ]
  18.      
  19. #Restrict Based on Trip Date End
  20.      
  21. Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Trips::TripDate: “<=$$ReportDateTo” ] [ Restore ]
  22.      
  23. #Must Sort records for reporting summary fields to work.
  24.      
  25. Sort Records [ Keep records in sorted order; Specified Sort Order: Customers::c_NameFull; ascending ] [ Restore; No dialog ] 

When I run the report I get error that says: "The provided find criteria is not valid. Enter a valid request before proceeding."  

If I debug the scrip, it stops at step 12 and says: 

[500] Date value does not meet validation entry options

I am tracking the $$REPDateFrom and To variables and I am even displaying it on my report and they seem to be getting the correct values, but the searches are not working. I do not have any validation entry options specified, other than the fact that all date fields are designated as date fields.

I am sure it's something stupid, but it has got me stuck. Thanks.

 

Outcomes