1

I have a liste of value and when a value = something i want it to calcultate a number of day between 2 dates. Error: "QE-DEF-0459 CCLException Incompatible data types in CASE statements"

Exemple: CASE WHEN ([Statut dossier] = 'Att 1 sv') THEN (_days_between (current_date;[Date start])) ELSE (0) END

I tried with IF, something like that: IF ([Statut dossier] = 'Att 1 sv') THEN (_days_between (current_date;[Date start]) ELSE ('0')

  • Welcome Sophie. Try to isolate where the error might be. Create a data item without the IF statement. i.e. _days_between (current_date;[Date start] and add that to the list. Is it showing the result you expect? Next try null instead of zero to see if it might be a data type or compatibility issue. – VAI Jason Jan 17 '23 at 15:01

2 Answers2

0

Since the error message mentions data types your first investigation should be of the data types of the things in the expression and the expression itself.

You will notice that you want a value of the days between two dates to be returned if your Statut dossier = 'Att 1 sv' but you want a string if isn't. Days between returns an integer, which is not compatible with strings.

So assuming that you want numeric values you would need to remove the ('0') and substitute (0). Assuming you want the result of the expression to be strings then you would need to cast the result of the days between expression to make it compatible with the else result. I'm guessing you want the former rather than the latter.

You will need to verify the usage of the expression as well, once you've gotten past this hurdle. You would need to determine if this is a measure or an attribute.

C'est Moi
  • 326
  • 1
  • 2
  • 8
0

Guessing, you may need to wrap the [Start Date] in a cast.

CASE WHEN ([Statut dossier] = 'Att 1 sv') THEN (_days_between (current_date;cast([Date start];date))) ELSE (0) END

Also watch the single quotes '0' is a string 0 is a number

Daniel Wagemann
  • 741
  • 4
  • 6
  • Hi, Thank you very much for your answer, I had tried with CAST, but clearly there had to be a problem with my formula, among other things, the 0, thank you!!! :) – sophie morin Jan 18 '23 at 13:10