Hi,
I am using Webi XIr2 on top of Sybase OpenClient v12.5.
When I execute a query with fixed date values, or select the dates from the BO Calendar, the results are returned within 1 minute.
However, I need a rolling date range in order to schedule the report for nighly execution.
When I substitute the hard coded values for date objects defined in the Universe it takes more than an hour to run.
eg - getdate() and dateadd(dd, 21, getdate())
I have tried to define these date variables using a derived table with no improvement.
I have even tried to create a CASE statement to substitute a calculated date when a string value is selected in a prompt - this has not improved things greatly either.
eg.
CASE @Prompt(‘1. Select Start Date:’,‘A’,{‘Minus Four Weeks’,‘Current Date’,‘One Day’,‘Two Days’,‘One Week’,‘Two Weeks’,‘Three Weeks’,‘One Month’},mono,free)
WHEN ‘Current Date’ THEN convert(date,convert(varchar(10), getdate(), 101))
WHEN ‘One Day’ THEN convert(date,convert(varchar(10), dateadd(dd, 1, getdate()), 101))
WHEN ‘Two Days’ THEN convert(date,convert(varchar(10), dateadd(dd, 2, getdate()), 101))
WHEN ‘One Week’ THEN convert(date,convert(varchar(10), dateadd(wk, 1, getdate()), 101))
WHEN ‘Two Weeks’ THEN convert(date,convert(varchar(10), dateadd(wk, 2, getdate()), 101))
WHEN ‘Three Weeks’ THEN convert(date,convert(varchar(10), dateadd(wk, 3, getdate()), 101))
WHEN ‘One Month’ THEN convert(date,convert(varchar(10), dateadd(mm, 1, getdate()), 101))
END
The DBA has told me that the date functions (eg getdate() ) cannot be used in the ‘where’ clause of a query as Sybase cannot use the indexes.
If the query is written in Sybase SQL it is possible to declare variables, and then use the variables in the ‘where’ clause. However, I do not think this is possible in BO.
I have used the date functions in Oracle in the past without any problem.
Can anyone suggest a solution to this problem?
Your help is much appreciated.
Many thanks, John.
John Warne Smith (BOB member since 2005-04-18)