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”)
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.
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")