@Prompt function in universe hack bo

5

Click here to load reader

description

@prompt function in SAp BO

Transcript of @Prompt function in universe hack bo

Page 1: @Prompt function in universe   hack bo

6/13/2014 @prompt function in universe | HACK BO

http://hackbo.com/2013/10/prompt-function/ 1/5

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’)

Page 2: @Prompt function in universe   hack bo

6/13/2014 @prompt function in universe | HACK BO

http://hackbo.com/2013/10/prompt-function/ 2/5

end

AND

case when

@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) =

‘Current’ then LAST_DAY(TRUNC(sysdate))

elseLAST_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 BETWEENcase 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’)

endAND

case when@Prompt(‘Please select month:’,'A’,’date object‘,Mono,Free,Not_Persistent,{‘Current’},User:-1) = ‘Current’

then LAST_DAY(TRUNC(sysdate))elseLAST_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 selectthe 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’

Page 3: @Prompt function in universe   hack bo

6/13/2014 @prompt function in universe | HACK BO

http://hackbo.com/2013/10/prompt-function/ 3/5

then add_months(trunc(sysdate,’MM’),-12)elsetrunc(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))

elseLAST_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’,’dateobject‘,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))

elseLAST_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:-)

Page 4: @Prompt function in universe   hack bo

6/13/2014 @prompt function in universe | HACK BO

http://hackbo.com/2013/10/prompt-function/ 4/5

0

Copyright secured by Digiprove © 2013 HuangLi

Some Rights Reserved

Categories: Universe, Webi Tags: Prompts, universe, webi prompt

RSS

Tag cloud

webi logs Apache BO awk shell webi wis js Mobile geomap maximizing performance FWM query operator sdk cms function webi

prompt cookie SIA ssl system database requested performance Oracle sso Prompts Administration opendocument Weblogic cms

universe IES 10901 Mobile chartset input control ep query builder jco cluster Dashboard t icket connection pools apache Xcelsius lov

chrome extension

Categories

Administration

Architecture

Mobile

optimization

Query builder

sdk

Tools

Universe

Webi

Xcelsius

Blogroll

li huang

Follow

0