Simple Custom Dialog to get date range for reports
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:
- 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" ]
- Set Variable [ $$REPDateFrom; Value:Trips::REPDateFrom ]
- Set Variable [ $$REPDateTo; Value:Trips::REPDateTo ]
- Enter Browse Mode [ ]
- Go to Layout [ “Trips HCBS” (Trips) ]
- #Restrict Basd on Funding Source
- Perform Find [ Specified Find Requests: Find Records; Criteria: Trips::TripFunding: “==HCBS” ] [ Restore ]
- #Restrict Based on Trip Date Start
- Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Trips::TripDate: “>=$$REPDateFrom” ] [ Restore ]
- #Restrict Based on Trip Date End
- Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Trips::TripDate: “<=$$ReportDateTo” ] [ Restore ]
- #Must Sort records for reporting summary fields to work.
- 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:
 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.