Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
krrohit1256
Contributor
Contributor

Replace null with a particular string for all the columns ( lets say 500)

i have to insert records in 500 columns.

I need to replace all the null values with a particular string line 'NA' for all the colums.

We can do it by checking null value for all the columns individually.

Is there any better way to achieve this ?

Labels (1)
3 Replies
tnewbie
Creator II
Creator II

Checking if is null for every column may yield an unwanted overhead at the processing front...instead you may put in default value for these columns at the tmap expression level either at the input or output as that suits your requirements.

0683p000009M5Jy.png

I Have very limited knowledge on Talend and trying to catch up with this Tool....hopefully that works

Anonymous
Not applicable

In case you are getting the data from a file, you can first read the whole row, make you transformation before split

If I have 500 columns, I will use tjavarow to split to columns.
With find replace, i can apply a function to all the columns

is not exactly your question, but i don't really see how to do what you are trying to do
lgati
Contributor II
Contributor II

The above answers are great, I didn't even know you could have default values in a tMap.

 

I was going to suggest the same as the second reply, use a tJavaRow component because you can type faster than having to do 500+ clicks on a tMap.

Add tJavaRow, click generate Code, it will be something like this:

output_row.column1 = input_row.column1;

change it to:

output_row.column1 = (input_row.column1 == null) ? "N/A" : input_row.column1;

this says, if column1 is null, then use "N/A" else use column1.