While working in calculation of dates in Webi report I came across a situation where
the “ToDate” function in Webi was not giving the result as expected. While doing some reasearch
on this understood that there was simple mistake happened and it can happen by anyone.
Would like to explain which is the mistake has done by general user/developer and
solution for this.
– One date is passed to the report as a prompt value and other date comes from the
Universe Object or query result.
1. MeetingDate is a prompt
2. Expiry date is an Object
Need to calculate the difference between these two dates. We can use DaysBetween
function in Webi.
Error: If I pass MeetingDate = 24th Oct 2012 (24/10/2012) while converting this string value into Date format it was
giving me the result as 24/01/2012.
As the MeetingDate is a prompt its data type is “String” so we need to convert this String into Date format.
For this we can use ToDate () function and we have to pass the correct format of the date.
– While converting the MeetingDate into date I used the following function
- In above syntax if I use “mm” and it gave me wrong result e.g. 24/01/2012
To get the correct result we have to use the correct syntax for month and it is like
When I used ToDate(UserResponse(“EnterMeetingDate”),”dd/MM/yyyy”) I got the correct
result as 24/10/2012.