If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Date prompts and scheduled reports

Started by urreacp, 23 Sep 2016 01:20:41 PM

Previous topic - Next topic

urreacp

Hello all,

Would really appreciate some help with an issue that I'm sure someone here knows how to fix.  I have a report that I want to run scheduled.  I have the date prompts set for the begin date to default to 1 week before the current date, and the end date is the current date.  I used HTML to make the begin date default, and when I run it manually it works fine.  When I run it scheduled though, it gives me an error saying the prompt values couldn't be determined.  I didn't override the default prompt values b/c I assumed it would put the date range in a fixed place and mess up my data for future reports. 

Any thoughts on how to fix this so I can make the date range dynamic?

Thanks in advance,
Christian

roddawg

have a similar issue...wrote a report, now they'd like to schedule it, but the date ranges change.  My filters originally were off the parameters...now I'm going to assign a data item the value of the parameter or getdate if the ParamCount ('Startdate') =0

if(paramcount('StartDate')=0) then (current_date) else (ParamValue ('StartDate'))

but that's giving me errors that ParamValue is not available as local processing
?StartDate? makes the value required and defeats the purpose.

dax

Hi

I'm guessing that your prompt page HTML/Javascript is not being run when scheduling, so the prompt value never gets set.  Could you just use something like this in your filters to get the last 7 days of data?

[Your Date Item] between _add_days (current_date,-7) and current_date

If you also wanted the ability to allow the user to run the report manually and specify the dates then this can be done using a prompt macro.

Cheers
Dax

BigChris


urreacp

Quote from: dax on 26 Sep 2016 02:02:13 AM
Hi

I'm guessing that your prompt page HTML/Javascript is not being run when scheduling, so the prompt value never gets set.  Could you just use something like this in your filters to get the last 7 days of data?

[Your Date Item] between _add_days (current_date,-7) and current_date

If you also wanted the ability to allow the user to run the report manually and specify the dates then this can be done using a prompt macro.

Cheers
Dax

Thanks for the responses, guys.  This is what I've tried so far, and it hasn't worked:  No prompt page at all, and in my main query I have something like this [Appt Date] >= 2 weeks ago and [Appt Date] <= Today.  This produces not results for me.

roddawg

I used the response by BigChris and it's been very helpful.  If you don't want a prompt page you'll simply need to static code your date fields.
Code should look something like this for your filter.

[Appt Date] between _add_days(current_date,-14) and current_date

urreacp

Quote from: roddawg on 07 Oct 2016 02:53:43 PM
I used the response by BigChris and it's been very helpful.  If you don't want a prompt page you'll simply need to static code your date fields.
Code should look something like this for your filter.

[Appt Date] between _add_days(current_date,-14) and current_date

I just played around w/ that exact same solution, and the issue is that when the built-in parameter 'Begin_Date' always defaults to today's date.  So in the main query, even I filter so the appt date goes back 7 days, it's like the Begin_Date built in paramter is always limiting me somehow.  Thanks for your responses btw.

roddawg

So I went back and read your original....html on a prompt isn't going to fix it.  If you know you always want 2 weeks worth of data. You don't need any prompts for Begin_Date or End_Date.  You will always just filter for the following

[Appt Date] between _add_days(current_date,-14)  and _add_days(current_date,-7)
The bolded parts take the place of any Begin_Date or End_Date.

urreacp

Quote from: roddawg on 07 Oct 2016 03:27:43 PM
So I went back and read your original....html on a prompt isn't going to fix it.  If you know you always want 2 weeks worth of data. You don't need any prompts for Begin_Date or End_Date.  You will always just filter for the following

[Appt Date] between _add_days(current_date,-14)  and _add_days(current_date,-7)
The bolded parts take the place of any Begin_Date or End_Date.

That's an interesting solution, and I tried that.  I did it w/ no prompt page at all, and no reference to the stock Begin_Date or End_Date parameters.  Then I schedule it w/ the prompt for values button unchecked.  When I do this, it doesn't run.  It gives me an error in the log saying that it cannot run due to 1 or more unresolved prompts.

Once again, thanks for your participation in my thread.  Much appreciated :)

roddawg

Right so you now need to remove any prompts on the prompt page you don't need or make them optional for testing.  Then when scheduling override the default prompts with your settings.

BigChris

QuoteI used the response by BigChris and it's been very helpful.

YAYY!!  ;D  ;D