Tuesday, March 20, 2012

SAP BusinessObjects: How to Display Web Intelligence Date Prompts using...

SAP BusinessObjects: How to Display Web Intelligence Date Prompts using...: While creating Webi reports some users always have a requirement for the display of Begin Date and End Date in the Report Header or Page He...

How to Display Web Intelligence Date Prompts using Built-in Functions

While creating Webi reports some users always have a requirement for the display of Begin Date and End Date in the Report Header or Page Header. We can achieve this by the Built in functions of Web Intelligence like UserResponse().

For e.g. If the user wants Transaction Start Date and Transaction End Date in the Page header of the report I would create something like this.

Drag and Drop a blank cell in the report and use the below formula in it:

="Transaction Date Between "+UserResponse ("Enter Trx Start Date")+ " and "+UserResponse ("Enter Trx End Date")

 
This would display the Start Date and End Date in the report but it would not remove the timestamp from the date which comes by default. 

What if I want to format my Date as per my choice and display only the Date. I would make use of the date formatting function called FormatDate(). In order to remove the timestamp I will have to user ToDate to convert the character date format to a desired Date format.

Below formula would achieve this

= "Transaction Date: " + "between"+ FormatDate(ToDate(UserResponse("Enter Trx Start Date") ;"MM/dd/yyyy hh:mm:ss A"); "MM/dd/yyyy") +" and "+ FormatDate(ToDate(UserResponse("Enter Trx End Date") ;"MM/dd/yyyy hh:mm:ss A"); "MM/dd/yyyy")

and the date prompt would look better. 

Thursday, March 15, 2012

How to create an object which displays Fiscal Quarter Year (in Universe Designer)

Often it is difficult to create an object which will give you the Quarter Number and Year as it involves Numeric and Date object. The following Case statement when parsed in Universe designer will give the Fiscal Qtr date as follows:

Quarter Logic:
(Jan,Feb,March--Q1(April,May,June--Q2),(July,Aug,Sep--Q3),(Oct,Nov,Dec--Q4)

Case 
When To_Char(date_object,'MM') In (1,2,3)  Then 'Q1' ||  to_char(date_object,'YYYY')
When To_Char(date_object,'MM') In (4,5,6)  Then 'Q2'  || to_char(date_object,'YYYY')
When To_Char(date_object,'MM') In (7,8,9) Then 'Q3'  ||  to_char(date_object,'YYYY')
WHEN TO_CHAR(date_object,'MM') in (10,11,12)  Then 'Q4'  ||  to_char(date_object,'YYYY')
ELSE '???'
End

For e.g. if we want to find the Fiscal Quarter Year for 15th March 2012 then this object will display Q12012

How to create a Dynamic Date prompt in Universe

Date prompt object will reduce our effort to create sysdate - n objects in our Universes.

With the help of this prompt we can include the object in the query filter and it would prompt the user to enter a date he wants to enter. We will need at least one sysdate object in the universe.

 Syntax: (trunc(sysdate - @prompt('Enter number of days', 'N',,,))