BusinessObjects Board

Interval Formats for Time

Hi. I have a number of measures in seconds. Id like to format them as interval time - some software has interval time formats. They would loook like โ€œHH:MI:SSโ€ for hours, minutes and seconds.

How can I do this in business objects webi? Would I need to build it out by parsing out hours, the remaining minutes, then remaining seconds and built a string with the results? Or is there a format mask?


twebber (BOB member since 2009-03-23)

I have an attribute called [T Login] - its a number in seconds. Hereโ€™s what I have come up with for interval formating. Its awful but works. Hoping someone else has a better way to do this.

=FormatNumber(Truncate([T Login]/3600;0);"##") + โ€œ:โ€ + FormatNumber(Truncate(Mod([T Login];3600)/60;0);"##") + โ€œ:โ€ + FormatNumber([T Login] - (Truncate([T Login]/3600;0)*3600) - (Truncate(Mod([T Login];3600)/60;0)*60);"##")


twebber (BOB member since 2009-03-23)

Hi,

Unfortunately, there is not such mask. You would need to build a formula that basically does what you described.

This old topic can help:


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Thanks Marek, Iโ€™ve done that. Is there a way that I can make this formula a generic function? ie format_time_as_interval(MyTimeAttribute) and it will return the string i want?

I dont relish copying and pasting the horrible formula i made all over the place.


twebber (BOB member since 2009-03-23)

Hi,

Sorry but itโ€™s not possible to create functions in WebI reports.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Thanks. I guess I could create columns for hours, minutes and seconds in a derived table then the formula would not be so long and complicated. But that adds lots of attributes to my uniiverse - about 30 new measures.

I see that there you can add functions to webi but you need to do this using c++ and the webi api.


twebber (BOB member since 2009-03-23)

updated formula with string padding.

=LeftPad(Trim(FormatNumber(Truncate(([T Talk]/[N Talk]) /3600;0);"##"))+"";2;โ€œ0โ€) + โ€œ:โ€ + LeftPad(FormatNumber(Truncate(Mod(([T Talk]/[N Talk]) ;3600)/60;0);"##")+"";2;โ€œ0โ€) + โ€œ:โ€ + LeftPad(FormatNumber(([T Talk]/[N Talk]) - (Truncate(([T Talk]/[N Talk] )/3600;0)*3600) - (Truncate(Mod(([T Talk]/[N Talk]) ;3600)/60;0)*60);"##")+"";2;โ€œ0โ€)

You would have to replace the [T Talk]/[N Talk] with whatever measure you have.

Output will be in format 00:00:00 for hours:minutes:seconds.


twebber (BOB member since 2009-03-23)