Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8975

Re: Prompt to get data for previous 5 days

$
0
0

Here's one way to do it; this example is for SQL Server, you'll need to amend per your backend database SQL functions (e.g. it will be different for Informix, Oracle, etc.)

 

Create a Universe filter. In the WHERE condition use the following:

@Select(Your Date Object) between dateadd(d,-5,@Prompt('Date:','D',,mono, free)) and @Prompt('Date:','D',,mono, free)

The first part - @Select - you should select the date object you want to filter.

 

The next part - dateadd(d,-5,@Prompt('Date:','D',,mono, free)) - will prompt the user for a date and will subtract 5 days from it (for anything other than 5 days, amend the number. The 'd' represents days, this can be substituted with months and years - see the DATEADD link in the above post)

 

Finally, we use the same prompt without the Dateadd function - which returns the same date as above.

 

Therefore, when the report is run, the user is prompted for a date, and the query is filtered to return only dates between the five days before the prompted date, and the prompted date itself.

 

HTH

 

NMG


Viewing all articles
Browse latest Browse all 8975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>