Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I'm working on Talend studio, I have a t_Map
I have a column of type double;
I'm writing the following expression :
row3.t_fixed != null && row3.t_fact != null
?
row3.t_fixed != 0 || row3.t_fact == 0
?
null
:
row3.r_std
:
null
However I'm getting an error saying it's nullPointer Exception
If I replace null with zero the job works fine, but I don't want to put zero but rather null
Kindly advise
Hi @ali_hijazi,
Can you please add a screen shot of your tMap Output Schema and also the log error?
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Hello @marksouzacosta
sorry for the late notice
Here is a screen shot of the tmap component
I created a variable called var_tarrifstd of type double
and this is the definition:
when I use null I get an error but when I use null the job works successfully
The code is Ok, I don't have the error.
row3.t_fixed != null && row3.t_fact != null
?
row3.r_std
:
null
Are you sure the error is in tarifstd field?
Yes the error is raised in tmap component while the field is nullable.
When I put zero then the job finishes successfully
Can you try to replace your whole variable code to just return null and add a tLog after the tMap (deactivating for now the nodes after the tMap)?
Your schemas are looking good so I'm just making sure the problem is in your tMap and on that field.
Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com
Can you make some examples with input values for row3.t_fixed, row3.t_fact, row3.r_std and expected values?
Could you show me the code for variable var_r_currency?
Thanks
it's the same:
but the field currency is of type string and it accepts null as value
I'm pretty sure there is something special about null in double data type
Hi,
I believe I understand where the problem is.
You are right! If you use a var in tMap as double, Talend build the code like this:
class Var__tMap_1__Struct {
double var1;
}
So you cannot use null value.
The solution is:
You haven't to use your code in Var field but you have to insert it directly in field Expression of tarifstd.