Hi
We have reports which need to be scheduled to refresh every month for prior month. To achieve this, I wanted to default the values for the prompts.
So after talking to BO support (they gave solution that it cant be done) and going through the forums like Dave’s blog and the following the topic
I created the following for the report
The report has to run for a period (yyyymm). This is of type integer. So created an object PriorPeriod as character and assgined the value
cast(year(dateadd(month, -1, getdate())) as varchar) + right(‘00’ + cast(month(dateadd(month, -1, getdate())) as varchar),2)
Then created another object PromptPeriod and assigned the Period but as character type. Modified its LOV to list both values from table for Period and PriorPeriod.
Created an object condition on PromptPeriod as below
(
cast(table.PERIOD as varchar) = @Prompt(‘Enter PeriodID:’,‘A’,‘Class \PromptPeriod’,Mono,Constrained,Not_Persistent,{‘PriorPeriod’},User:0)
or
(
‘PriorPeriod’ = @Prompt(‘Enter PeriodID:’,‘A’,‘Class\PromptPeriod’,Mono,Constrained,Not_Persistent,{‘PriorPeriod’},User:0)
and
cast(table.PERIOD as varchar) = cast(year(dateadd(month, -1, getdate())) as varchar) + right(‘00’ + cast(month(dateadd(month, -1, getdate())) as varchar),2)
)
)
In the WebI report, created a query filter for PromptPeriod and defaulted it to PriorPeriod.
The issue is when I run the report for the PriorPeriod, I get both the condition one from the Query filter and another predefined condition as below
WHERE
cast(table.PERIOD as varchar) = ‘PriorPeriod’
AND ((
cast(table.PERIOD as varchar) = ‘PriorPeriod’
or
(
‘PriorPeriod’ = ‘PriorPeriod’
and
cast(table.PERIOD as varchar) = cast(year(dateadd(month, -1, getdate())) as varchar) + right(‘00’ + cast(month(dateadd(month, -1, getdate())) as varchar),2)
)
))
The PriorPeriod in the bolded condition which is from Query filter doesnt get the value. What am i missing in this.
Thanks
Poongs
Poongs (BOB member since 2009-07-20)