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

Should Be A "Simple If Then Else", but ...

Started by Cognos_Jan2017, 16 Mar 2017 05:03:48 PM

Previous topic - Next topic

Cognos_Jan2017

Running Cognos 10.2.2
Have 2 Query Calculations in adjacent columns ... My code has Fully Qualified Paths, but below are simplified to just Query Item/ Field names ...
1 - DiffDays ... to show [Created Date] has been entered, closing the Incident ...
_days_between(cast([Created Date], date) , Cast([Date Of Incident], date))

2 - ContinueDays ... to show [Created Date] has NOT been entered, meaning Incident unresolved ...
_days_between(current_date, [Date Of Incident])

We need a "Simple" If to test if [Created Date] Is NULL, so ...
If [Created Date] Is NULL
Then
_days_between(current_date, [Date Of Incident])
Else
_days_between(cast([Created Date], date) , Cast([Date Of Incident], date))
... BUT isn't working.

HHEELLPP ... TIA, Bob

tjohnson3050

Try using coalesce instead.  Returns the first non null value.

_days_between(cast(coalesce([Created Date],current_date),date),cast([Date Of Incident],date))

Cognos_Jan2017

THANK you.  It WORKS !!!

Too many years VB/ VBA relying on If Then Else, and Select Case.

I now have a new Tool in the Toolbox.