Back to forum

Convert measurable field (like Seconds) to hh:mm:ss

Answered

I checked few previous answer but their requirement was related to Date.
In my case, we get time in form of Seconds(duration) from the API.
Now we want to convert the numeric seconds to hh:mm:ss.
i.e. instead of showing 3890 we need to show 01:05:50

Note : Please note that “Duration” is measure field and therefore SUM is used in its formula.
Example :
{
Id: “I894”,
Duration : “3890”,
Long:”SM”,
Range:”LH”
}
 

4 answers

WebDataRocks Team WebDataRocks August 18, 2020

Hello, Raj,
 
Thank you for your question.
 
The desired result can be achieved by specifying the time data type for the “Duration” field.
Please see an example demonstrating the mentioned approach.
 
Detailed information about supported JSON data types and the way to define them can be found in our documentation.
 
We hope it works for your case.
Please contact us in case other questions arise.
 
Regards,
WebDataRocks Team

Raj August 18, 2020

Thanks you, so nice of you.

This works as expected, but I noticed that it doesn’t works for High Chart.(created using PIVOT table).
It would be great if you could assist us on this.

WebDataRocks Team WebDataRocks September 18, 2020

Hello, Raj,
 
Thank you for contacting us.
 
We want to explain that Flexmonster provides Highcharts with raw data. It means time formatting is not applied on values passed to the Highcharts instance.
Currently, we are not ready to recommend the workaround to overcome this limitation.
 
Our team suggests checking our Flexmonster Pivot, which is a premium product developed by the same team. Flexmonster allows preprocessing the data before it is passed to the charting library (prepareDataFunction).
 
We hope it helps.
Please contact us in case other questions arise.
 
Kind regards,
WebDataRocks TeamĀ 

Move up