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.
Scenario:
- 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.
Solution:
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.
Mistake:
- While converting the MeetingDate into date I used the following function
To get the correct result we have to use the correct syntax for month and it is like
“dd/MM/yyyy”
When I used ToDate(UserResponse(“EnterMeetingDate”),”dd/MM/yyyy”) I got the correct
result as 24/10/2012.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |