BusinessObjects Board

Format a UserResponse

I have a date prompt in the Universe and I tried to format the User Response in the webi report to show only the date part, no timestamp. I am not sure why I got #ERROR.

=ToDate((UserResponse (“2 - Enter Start Date”)); “mm/dd/yyyy”)


vanessa (BOB member since 2009-01-20)

Hi,

Have you tried adding the name of the data provider as the first parameter of the UserResponse function? Check in the help the exact syntax of the function and what its parameters are.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

or else you can format the data object by creating a new object. Then in the report you can directly use userresponse([dataprovider]; object)


ay1224 :us: (BOB member since 2007-07-30)

If there is time part also in the userresponse value then it should be

=FORMATDATE(ToDate((UserResponse ("2 - Enter Start Date")); "mm/dd/yyyy hh:mm:ss");"mm/dd/yyyy") 

Assuming that the date value passed is in the format mm/dd/yyyy hh:mm:ss

.


haider :es: (BOB member since 2005-07-18)

Thanks for all your replies. I have tried to add the Data Provider name in the UserResponse formula and/or formatdate, but I still got #ERROR.


vanessa (BOB member since 2009-01-20)

Try this formula: (if thger is timestamp in your prompt values (lov’s))

ToDate((UserResponse (“2 - Enter Start Date”)); “mm/dd/yyyy hh:mm:ss”)


rj_srnth (BOB member since 2006-12-09)

I think the problem is with your date format. What is it exactly? Use that format as the second parameter of ToDate() function.


Jansi :india: (BOB member since 2008-05-12)

If it is webi you should use MM instead of mm in the date format.

Is the prompt a date or alphanumeric? i.e. is it @prompt('Enter date#,‘A’,) or you have ‘D’

If it is D you should use formatdate.


nathan_nathan (BOB member since 2008-10-27)

Just give one sample value of date in LOV. then we can give you exact formula…


Mandar_Deshpande :us: (BOB member since 2005-05-16)

Change the cell format to mm/dd/yyyy and then try.


rohit12 :india: (BOB member since 2008-11-08)

Actually cause of error is your todate function right, this is because userreponse returns the date as STRING and that too complete data with TIME, your string will be like “01/01/2009 12:00:00 AM”, now when you try to apply todate on this half of the string doesn’t find any corresponding format but for ToDate you have to specify date format exactly in the same way as it is in string.

Secondly if you write “mm/dd/yyyy” in format it won’t take actual value of month, you have to use “MM/dd/yyyy”.

Below is surely going to work:

1. Create a variable Date =UserResponse ("2 - Enter Start Date")
2. Truncate your string such that it only have date information.
    Date1 =Substr([Date];1;Length([Date]-12)
3. Finally
    =Todate([Date1];"MM/dd/yyyy")

I did above breakup to explain the procedure, you can create single variable by merging them

=Todate(Substr(UserResponse ("2 - Enter Start Date");1;Length(UserResponse ("2 - Enter Start Date"))-12);"MM/dd/yyyy")

If you want Timestamp as well then use

=ToDate((UserResponse ("2 - Enter Start Date")); "MM/dd/yyyy hh:mm:ss tt")

Prashant Purohit :india: (BOB member since 2009-02-18)

=Todate(Substr(UserResponse(“2 - Enter Start Date”);1;
Length(UserResponse(“2 - Enter Start Date”))-12);“MM/dd/yyyy”)

This logic works beautifully. Thanks for all!


vanessa (BOB member since 2009-01-20)