Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

corresponding types must be compatible in CASE expr

Status
Not open for further replies.

umag

Programmer
Sep 20, 2002
28
US
Hi
I am using ImpAdmin 7.0 with informix DB. I have a problem here with if statement in one of the field of my report. Calculated field definition in report look like this

if (flag = 'S') then (loanamt) else (0)

impromptu throwing error as 'corresponding types must be compatible in CASE expr'. Based on string I need amount. Does anyone faced similar problem. If so how are guys tackling this situation.

Thanks
Umag
 
It looks like loanamt is not being recognized as a number. Could this be a datatyping issue? (i.e. loanamt being a type long or double precision packed number?).

Dave Griffin
The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ20-2863 first!
 
Thanks Dave
I looked into the database and the type is float(I am using informix DB). Instead of that column if I selected other column with datatype is integer it is working fine. I don't understand why is this weird behaviour, if you know please help me understand that.

But for the problem I have found a workaround i.e I am writing a hidden in column in report which is

if (flag = 'S') then ('1') else (2) and using this hidden column to get result like this

if (string_to_number(hidden_column)= 1) then (loanamt) else (0)

It is working fine, but still I want to know the reason.

Thanks
Umag
 
I seem to recall having had a similar problem a long time ago. What happens if you try:

if (flag = 'S') then (loanamt) else (0.0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top