BusinessObjects Board

Substracting dates

hi ,

I need to calculate the elapsed time between two transactions. I have the times but I get error whe I try to substract them. I have created a new class in the designer with string type for my time. I got the time as string try to substring the hour , the minutes and the seconds, I am able to perform some operations but I guess this is deadend…

If any one has worked on this issue please give me some clues how to tackle this…

Thanks

Emile


Emile (BOB member since 2003-06-06)

What DBMS (Oracle, IBM DB2, etc.) are you using?
Can’t you do the calculation at the universe or DB level instead?

Passing time and/or dates as STRINGS/CHARACTER is ususally not a good idea, because then you loose the correct sorting and cannot easily do time difference calculation IMHO.

Also, if you do a search on BOB there has been a thread with a formula how to calculate time differences within BO Reporter (down to the second).

Or take a look at this thread: Variance calculation


Andreas :de: (BOB member since 2002-06-20)

I recently offered a solution on tek-tips forum which may be of use to you.

It does look complicated but works quite nicely:

http://www.tek-tips.com/viewthread.cfm?SQID=692219&SPID=393&page=1

This is the bottom line:


blom0344 :netherlands: (BOB member since 2002-09-04)

Hi

Thanks a lot for the approach… finally I also came to this … converting everything in hours , substracting them and converting the result again in hours . min and sec…

I was hoping for a simpler solution but I guess that is the way …

Thanks a lot once again…

Emile


Emile (BOB member since 2003-06-06)

I guess you are working with ORACLE? In DB2 there is the TIMESTAMPDIFF function one can put to use in the universe to calculate the time difference between 2 timestamps. My guess is that a user defined function should be possible.

An example:

That should enable calculations outside the report, at the DB level…


blom0344 :netherlands: (BOB member since 2002-09-04)

Remember: in the link I gave you Ken Gaul has written a DLL that you can add to BO, which will add a new BO Reporter function to calculate date/time differences.


Andreas :de: (BOB member since 2002-06-20)

That may be a suitable solution , but would a function at database level not be more generic? Locally adding DLL’s may work fine technically, but having solution through the DP would be a lot easier to support and maintain…


blom0344 :netherlands: (BOB member since 2002-09-04)