If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Datetime interval not negative

Started by msm, 01 Mar 2010 04:03:53 AM

Previous topic - Next topic

msm

In our report this expression gives the timeinterval in hours.
DTinterval2stringAsTime(int2DTinterval(([Hoofd Query].[Realisatie in minuten incl. contracturen]),'m'))

The calculation should give a negative amount of time -06:00. But it shows no negative sign only 06:00. How can I make clear that is't a negative amount of time?

Thanks

CognosAdmn

What is your database? Your database may have some functions to get negative minutes.

else

create a another query calculation in your report and multiply the number by (-1)

msm

Quote from: CognosAdmn on 01 Mar 2010 09:12:25 AM
What is your database? Your database may have some functions to get negative minutes.

else

create a another query calculation in your report and multiply the number by (-1)

It's a DB2 database. multiply by -1 makes all values negative. It's a calculation A- B the answers can be positive or negative. Now it makes all positive

Pramod

One solution is to use if condition
if(B>A) then -1 *(A-B)
else( A-B)
:)

msm

#4
Quote from: Pramod on 02 Mar 2010 04:05:09 AM
One solution is to use if condition
if(B>A) then -1 *(A-B)
else( A-B)
:)

The calculation shows te correct negative answer. But when we display is as time with the function DTinterval2stringAsTime(int2DTinterval(([Hoofd Query].[Aanwezige uren (geroosterd)]),'m'))

All the negative numbers become positive.
---------------------------------------------
DTinterval2stringAsTime
Returns a date time interval as string. The days are converted to hours. Output format: "HHHH:MM:SS.FFFFFFF" or "HH:MM:SS.FFF".

Syntax
DTinterval2stringAsTime(DTinterval_exp)