Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set dynamic default value for month/year in a parameter prompt

Status
Not open for further replies.

wd40123

Programmer
Aug 5, 2007
1
US
I am referencing a model data item, Month#, in a Value Prompt. It will use a display value of the actual month. For example, the report will USE the value of 6 when the DISPLAY value of June is selected.

My question is: how can I set the default to the CURRENT MONTH based on today's date?

I face a similar issue with a Value Prompt for the Year.

I am new to Report Studio, and can only see a way to set a literal value rather than have this be determined dynamically.
 
While assigning/specifying a default selected value(s) for a value prompt IS possible, I fear this sort of dynamic behavior (that will automatically change the default value) is NOT possible.

However, if you can have the report run on the schedule WITHOUT the explicit prompt for values, then you CAN have the report dynamically select the current month.

What you'd need to do is set up a filter (non-prompt type) that will effect your MONTH# data item. The filter will look something like:

[MONTH#] = month(current_date)

Using the current_date function will act as the "dynamic" bit you're after every time the report is run. month() will pull out the month value.


**bonus**
If you need to run the report a few days AFTER the end of the month, then try something like:

[MONTH#} = month(_add_days((current_date),-10))

Since today is August 6, this would pass the Current date - 10 days as the timestamp that the month() function enacts upon.

_mbuono
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top