/* */


Dec 31 2010

Remove Time from User Selected Date

Category: Business ObjectsTauseef @ 3:14 pm

Scenario : We know that if you get the user response for the date selected by a user Business Objects returns a date time on the Webi Report even if the field represents a date in the Database.I have a Day Dimension and the column dt_name contains date with no time.

dt_name

12/25/2010

12/26/2010

12/27/2010

12/28/2010 etc. When one of this value is selected by a user when prompted for a date say the user selected 12/27/2010 then on the report the userresponse would look like this 12/27/2010 12:00:00 AM. There are different approaches that people follow lets discuss one that i have been using.

Resolution : In order to get just the date we need three variables VAR1, VAR2, VAR3. Let us define these variables.

VAR1 = UserResponse(“Date Prompt Text”)

VAR2 = Length(VAR1)

VAR3 = If((VAR2=8) OR (VAR2=20); Substr(VAR1;1;8); If((VAR2=9) OR (VAR2=21); Substr(VAR1;1;9); If((VAR2=10) OR (VAR2=22); Substr(1;10))))

let us understand how this works.

VAR1 gets the date selected by the user with the time so it is 12/27/2010 12:00:00 AM

VAR2 returns the length of  VAR1 which can have possible values of 8,9,10,20,21,22.

VAR3 checks the value of VAR2 if a certain criteria matches then it extracts the date from the date time value. In the above example VAR2 will have a value 22 so the third IF condition is executed.

Tags: , , , ,

One Response to “Remove Time from User Selected Date”

Leave a Reply

You must be logged in to post a comment. Login now.