Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Vivi2
Contributor III
Contributor III

[Tmap - Tdbouptut], Update only field if it is not null

Hello,

I need to update fields in my database if the value is not null.

0695b00000QF4jxAAD.png

In

Target

I have already these values :

{Id : 3, Name : GUEST, First_name: Hope, Age:3}

In Input : I have

{Id : 3, Name : GUEST,

First_name: ""

,

Age:6

}

Normally after the update I should have {Id : 3, Name : GUEST,

First_name: Hope , Age:6

} but I have : {Id : 3, Name : GUEST,

First_name: "", Age:6

}

The first name was updated by a null value.

Note that the first name field can be nulled. If I check Nullable in tmap and

If I have in target {Id : 3, Name : GUEST,

First_name: "", Age:3

}

and INPUT ; {Id : 3, Name : GUEST,

First_name: "", Age:6

} I will have

nullpointer error.

How to do?

Thanks

Labels (2)
1 Reply
Anonymous
Not applicable

Hi

The result is normal output, all fields will be updated if the key exists, there is no option that we can configure the filed to be not updated if it is null. The workaround for this issue is doing an inner join with target data base on key column id, eg:

input--main(row1)--tMap--out1--target

|lookup(row2)

target

set the expression of name column in the output table of tMap like:

row1.name==null?row2.name:row1.name

 

The field will use target's value if the source value is null.

 

 

Regards

Shong