Author Topic: Count the number of days between two dates in Cognos 8.2 Data Item  (Read 1571 times)

Offline cbyrne

  • Full Member
  • ***
  • Posts: 38
  • Forum Citizenship: +1/-0
Hello does anybody know how to count the numbers of days between two dates in a Data Item and in Report Studio 8.2.  The code below is for 8.4 but i do not have _days_between in the data item.

Data Item
_days_between(sysdate(),[DATEREPORTED])


Thanks

Chris

Offline technomorph

  • Senior Member
  • ****
  • Posts: 70
  • Forum Citizenship: +2/-0
Which DB?

Offline peritas-chris

  • Full Member
  • ***
  • Posts: 45
  • Forum Citizenship: +3/-0
Use current_date, you should be able to use the _days_between function with that.

_days_between(current_date,[DATEREPORTED])
Chris F
Peritas

Offline srinivas_p

  • Community Leader
  • *****
  • Posts: 119
  • Forum Citizenship: +1/-3
Use current_date, you should be able to use the _days_between function with that.

_days_between(current_date,[DATEREPORTED])

Hi first check what is [DATEREPORTED] column returning? check is that a date or a key? if that is not mapped with a date ? then u need to cast DATEREPORTED to DATE, then apply
the _days_between (sysdate(),[DATEREPORTED])

because sysdate is a DATE attribute with a timestamp

Hopes it fixes Ur problem

Offline cbyrne

  • Full Member
  • ***
  • Posts: 38
  • Forum Citizenship: +1/-0
Thanks Guys this worked a treat i inserted _current_date into the data item and it worked fine.

Many Thanks

Chris

Offline peritas-chris

  • Full Member
  • ***
  • Posts: 45
  • Forum Citizenship: +3/-0
No problem, glad to hear it worked for you!
Chris F
Peritas