This will require Builder privileges for setup and implementation.
In an iDashboards expression, you can use math functions! Yay! Math is fun!
- Math.abs(y1) returns |y1| the absolute value of y1
- Math.round(y1) rounds up if the fractional-part of y1 >= 0.5 and rounds down if the fractional part of y1 < 0.5
- Math.ceil(y1) rounds up to the nearest whole number
- Math.floor(y1) rounds down to the nearest whole number
Note: case matters. Make sure the function (abs, round…) are in lowercase.
// number of milliseconds in one hour
var ONE_HOUR = 1000 * 60 * 60
// convert dates to milliseconds
var startDate_ms = y1.getTime()
var endDate_ms = y2.getTime()
// Calculate the difference |endDate - startDate|
var difference_ms = Math.abs(endDate_ms - startDate_ms)
// convert back to hours
Math.round(difference_ms/ONE_HOUR)
Example
If a driver leaves a location at a given start time and arrives at a destination at a given end time calculate the how many hours a driver was on the road.
Assign y1 as Project Manager
Assign y2 as the start date
Assign y3 as the end date
For y4 copy the expression below:
-
-
Math.abs(Y3 - Y2)/3600000
-
Tabular Chart with the Data
For More Information:
- OSKAR: Data Analytics
- Dashboard & Chart Design Articles
- iDashboards Builder Manual 14 Analytics
- For more functions see: JavaScript Math Library
- iDashboards Builder Manual 9.11 Tabular Charts
- iDashboards Builder Manual 8 Designing Charts
If the above is unable to resolve the issue, then please contact truOI Support for further assistance.
Comments
0 comments
Please sign in to leave a comment.