Question
Centene
US
Last activity: 17 Jul 2017 15:45 EDT
Default Report Parameters to Current Date (or some function)
Hello everyone,
I am building a report, with parameters for a date range - StartDate, EndDate, that kind of thing. I see the Parameters Tab has a "Default Value" box, but it seems that it does not want to accept a formatting or function value such as
@FormatDateTime(@CurrentDateTime(), "MM-dd-yyyy", "EST", "")
I don't want to hard code in an ACTUAL date, but rather, am trying to find a way to make the default value be something like "Current Date", or "1st day of current month", etc. Can i put in a date function in the DefaultValue?
Hello everyone,
I am building a report, with parameters for a date range - StartDate, EndDate, that kind of thing. I see the Parameters Tab has a "Default Value" box, but it seems that it does not want to accept a formatting or function value such as
@FormatDateTime(@CurrentDateTime(), "MM-dd-yyyy", "EST", "")
I don't want to hard code in an ACTUAL date, but rather, am trying to find a way to make the default value be something like "Current Date", or "1st day of current month", etc. Can i put in a date function in the DefaultValue?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems
IN
Current Month
Pegasystems
IN
You can try Today
Pegasystems
IN
Actually you can use any of the symbolic dates that the filters allow you for DateTime properties as default value for your DateTime parameter(s). To see the list of allowed symbolic dates, click on "Select values” next to a filter. This will show you "Time Periods” where Today is present among others.
-
safouene jemli
Centene
US
Pegasystems
IN
As I said, the values that are visible for filters when you click on "Select values” are the same values that you can use as default value when you define your parameters. I am not asking you to choose that value for the filter. I was just trying to point out where you could get the list of allowed values that you could use in the default value field for parameters. The right hand side of the filter will still say Param.StartDate
Centene
US
hmmm
When I try that It gives me a big red block of errors. I'll check my syntax.
Updated: 17 Apr 2015 9:18 EDT
Pegasystems Inc.
GB
Jim... Are you using the param value in the criteria?
It may be that you are mixing Date and Date Time types. I got an error too when I first tried this.
Try making your parameters Date Time rather than Date as i think "Today" will actually return a Date Time and this would need to match the property that you are comparing it to in the report criteria.
-
Fernanda Martínez
Pegasystems
IN
Pasting a screenshot with the errors might help us identify the problem.
Centene
US
how would I say "get me the first of the current month"?
Accepted Solution
Pegasystems
IN
Current Month
Centene
US
thanks again Rajiv. I believe I have it working now. It just puzzled me as the Parameters page does not have the up/down arrow or a choice for these functions, in the way that the Query page does.
Pegasystems
US
I think the default value on the parameters tab (at least for activity rules, not sure if this is different for the parameters tab of other rules such as report ones) only applies for manually driving the rule with the "run" button from the ruleform, and that the default value of a parameter shown on the parameters tab is not applied if the rule is called from the user's app. /Eric
Pegasystems
IN
Hi Eric,
We don't distinguish the run button from the execution of the report from grids or data pages or anything else in the application.
-Rajiv
Pegasystems
US
Thanks Rajiv. So, I’m curious now, if the default value for a parameter is specified as “.foo” on the parameter tab, how do you know whether the value should be those four characters literally, or whether it means at-the-time-the-rule-starts-fetch-the-contents-of-property-foo ? /Eric
Centene
US
I think I have it working now, Eric. Here's what I did
- Created a report, with query WHERE conditions at the bottom
- Created Parameters ("StartDate", "EndDate") and defaulted them to "Current Month"
- Set the Query to reference Param.StartDate and Param.EndDate
- Set the Report Viewer tab to "Prompt for filter changes before displaying a Report"
Now, in the Case Manager Portal that the user sees, when they run the report, they are prompted for the dates (and the defaults are displayed). If they don't change anything, it runs for the current month. If they change them, it runs for the date range specified.
Thanks again!
-
Praveen Grandhi