call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
@Prompt function in universe hack bo
1. 6/13/2014 @prompt function in universe | HACK BO
HACK BO
Anything related to bo
Home
About me
sitemap
Type text to search here...
Date prompt in universe
October 9th, 2013 huangli+ No comments
Almost all the BO reports has a prompt to filter data, the date filter plays an important role in report filter, so
today I am going to summarize some of the most used @prompt in universe.
Background
Database: Oracle
BO: BO 4.1 sp6
The database function list: trunc, sysdate, last_day,add_months.
The green character: the variable in function, the variable name may change depend on your system environment.
The orange character: the orange character is the function script.
1. Date range filter
Appearance: Date range filter @prompt function .
Functionality: The user may use the default current parameters, which means current year and month, or select
the date he/she wish.
Implement:
Datebase.date column BETWEEN
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) =
‘Current’ then trunc(sysdate,’yy’)
else
trunc(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’),’yy’)
http://hackbo.com/2013/10/prompt-function/ 1/5
2. 6/13/2014 @prompt function in universe | HACK BO
end
AND
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) =
‘Current’ then LAST_DAY(TRUNC(sysdate))
else
LAST_DAY(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’))
end
2. Begin of the year to selected date filter
Appearance: Date range filter @prompt function.
Functionality: The user may use the default current parameters, which means current year and month, or select
the date he/she wish. e.g. the user may select 2013-03, then the date range would be 2013-1 to 2013-03. The
start month would always be the January and the year is the user selected year.
Implement:
Datebase.date column BETWEEN
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’
then trunc(sysdate,’yy’)
else
trunc(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’),’yy’)
end
AND
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’
then LAST_DAY(TRUNC(sysdate))
else
LAST_DAY(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’))
3. Past 12 months filter
Appearance: Date range filter @prompt function.
Functionality: The user may use the default current parameters, which means current year and month, or select
the date he/she wish. e.g. the user may select 2013-03, then the date range would be 2012-3 to 2013-03. The
user may want to see the trend in the past 12 months, so this kind of prompt is very popular.
Implement:
Datebase.date column between
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’
http://hackbo.com/2013/10/prompt-function/ 2/5
3. 6/13/2014 @prompt function in universe | HACK BO
then add_months(trunc(sysdate,’MM’),-12)
else
trunc(add_months(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’),-12))
end
and
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’
then LAST_DAY(TRUNC(sysdate))
else
LAST_DAY(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’))
end
4. Past n years filter
Appearance: Date range filter @prompt function.
Functionality: The user may use the default current parameters, which means current year and month, or select
the date he/she wish. e.g. the user may select 2013-03, then the date range would be (2013-n)-01 to 2013-03.
The user may want to see the trend in the past few years, so this kind of prompt is also very popular.
Implement:
Datebase.date column between
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’
then trunc(add_months(sysdate,-12*n),’YYYY’)
else
trunc(add_months(LAST_DAY(to_date(@Prompt(‘Please select month:’,'A’,’date
object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1),’YYYY-MM’)),-12*n),’YYYY’)
end
and
case when
@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’
then LAST_DAY(TRUNC(sysdate))
else
LAST_DAY(to_date(@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,
{‘Current’},User:-1),’YYYY-MM’))
end
You may customize the script for your own needs, hope it may helpful for you:-)
http://hackbo.com/2013/10/prompt-function/ 3/5