One Star

tMap problem with int and double, and 0/Null values

Hi,
I saw here that this problem is not new, but the bug attached (1450) is marked as resolved. I use the latest version downloadable (v2.1.0 r4515), and I nearly have the same problem:
In the tMap component, a value is given to all the output fields which are not linked instead of giving them the Null value. Moreover, there is a problem with fields of Double type, because they take the value "0" and it give me the following error: "Expression of table.field is invalid: Error on 0 => Type mismatch: cannot convert from int to Double."
Is this a bug?
Thanks in advance...
Regards,
Nicolas.
6 REPLIES
One Star

Re: tMap problem with int and double, and 0/Null values

I have forgotten to say: my Input and Output are Oracle connections, with fields in Number DB type, but used as Double...
One Star

Re: tMap problem with int and double, and 0/Null values

Up and update: bug attached in bug tracker here => 1562
Employee

Re: tMap problem with int and double, and 0/Null values

Sorry for my late answer.
I think your problem is on your input column, indeed when "int" type is used ("int" is a not nullable type), dafault value 0 is put into when NULL value is encountered from Database.
It's the reason that you have the error "Expression of table.field is invalid: Error on 0 => Type mismatch: cannot convert from int to Double."
Then you can use this expression in your output column :
row1.ID_INTEGER == null ? null : row1.ID_INTEGER.doubleValue()
which will return null if your input column has null value else the double value of your integer.
One Star

Re: tMap problem with int and double, and 0/Null values

thanks for this, it can help me for the moment.
But the problem, in fact, is that there is no link to this field of my output table, and ALL Double fields are instancied with 0 as Default value. (another thing I noticed is that some of my fields are "double" and others are "Double", whereas I have selected always the same type...)
Employee

Re: tMap problem with int and double, and 0/Null values

Ok I reproduced you problem, indeed null should be automatically set by default for object types (Integer, Long, Double, etc.) when entry is empty.
Set null value explicitly to get round this bad behavior.
"double" is a primitive type, it does not accept null values and it is more performant than Object types. It is activated when Nullable checkbox is unchecked.
"Double" is an Object type, it accepts null values. It is activated when Nullable checkbox is checked.
One Star

Re: tMap problem with int and double, and 0/Null values

oh, thanks!!! I didn't noticed that my tries for the "null" value where on double type... (yes, I'm dumb... ^^)
So I can now go on with this. Thank you very much for your answers!!!