Using IF Then Else with Days Between - Cognos

53 views Asked by At

I'm trying use an if then else statement to calculate the number of days a case has been unassigned.

If the case is classified as unassigned I want to count the days between today, and the day the case was originally created. If the case is not unassigned I want to return just the word assigned. The only two outcomes for Case State Description are Assigned/Unassigned.

The sample I tried based on watching some videos is below, but I am getting several parsing errors, which for some reason I cannot copy from cognos and past here.

If ([Case State Description] = 'Unassigned') then (days_between (CURRENT_DATE,[Case Create Date])) else ('Assigned')
1

There are 1 answers

0
Daniel Wagemann On

It would be nice to see the actual errors. Looking at your expression it might be a data type issue. Your if then can result in a numeric or string depending on the record.

Try: If ([Case State Description] = 'Unassigned') then (cast(days_between (CURRENT_DATE,[Case Create Date]),varchar(4))) else ('Assigned')

If it still fails, please post the error.