1

So, in Cognos Report Studio i have a query item with this expression that is getting me an error that i still need to figure out. The expression is this:

IF (( current_date - [Submission date]) > 30) then ('Yes') ELSE ('No')

And the error is this:

UDA-EE-0094 The operation "greater" is invalid for the following combination of data types: "interval2" and "integer"

[Submission date] in the framework level its used as an attribute and in the format is formatted as a date in 'Date Style'

1 Answers1

1

AS i don_'t know if you have native sql enabled and the could use DATEDIFF.

use the Cognos function _days_between()

IF (_days_between(( current_date, [Submission date]) > 30) then ('Yes') ELSE ('No')
dougp
  • 2,810
  • 1
  • 8
  • 31
nbk
  • 45,398
  • 8
  • 30
  • 47
  • 1
    This is probably the right answer. I'm surprised the error isn't about performing arithmetic on dates. I have never been able to get away with that in Cognos -- maybe because I use SQL Server. The OP didn't state they were looking for the difference in days. Do we have a requirement, or just an error message? Plus, we're talking about a tool that uses databases. I prefer `CASE` statements because they feel more like SQL. – dougp Jun 23 '22 at 14:46
  • Thank you soo much!! Its working finally but still shitty error of this bad tool – Lusi Saliai Jun 23 '22 at 15:20
  • 1
    Actually, the error is not that bad considering. It doesn't take much to realize where the interval is. The result of an operation subtracting one datetime from another will be an interval data type. The result of _days_between will be an integer, which is compatible with the value you are using in the expression. Don't know why you are working with CQM and not DQM. – C'est Moi Jun 23 '22 at 15:54