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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query by Date

Status
Not open for further replies.

skimasked

Programmer
Mar 4, 2001
10
0
0
GB
Hi,
I need to run a query in business objects that gives me data for the last five days, one option is to get the user to enter the date from which they want the reporting to start, via a prompt. Is there a way in which I can do this without the user having to enter dates?

Thanx in advance
 
Assuming your database is Oracle you could use sysdate like this

Select statement

......

where your_date_field => sysdate -5

you'd need to build this as a filter object I think

Other dbs probably have a sysdate equivalent
 
You can create a filter at the universe level.

Definitions:

Date handle in table: @Select(Site Counts\History Date)
Date function (DB2 Only): {fn Curdate()}
Date function (MS Sql only): Getdate()

if you are using DB2:

@Select(Site Counts\History Date) >= {fn Curdate()} - 5 days

if you are using Microsoft Sequel:

@Select(Site Counts\History Date) >= Getdate() - 5 Days

if you do not know what the most recent day you have in your table to query, then you must do a subquery to get the max, then subtract 5 days from that in your filter.

However you can get your resident DBA to provide you with the proper sequel syntax.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top