Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to set default integer value for a column

Hi,

 

I want to set the default value of the certain column to 1. Should I make the change in the input file by defining the default value as "1".

I tried couple of combinations by making it as 1, or "1", change the field type to String. But nothing works.

 

How do I set value to 1..? Thanks!

 

0683p000009Lwqt.png

Labels (2)
8 Replies
Anonymous
Not applicable
Author

Hi
Why you need to change the default value? Normally, the default value only works when creating tables on DB output component.

Regards
Shong
Anonymous
Not applicable
Author

Hi Shong,

 

It's a business scenario where they want one of the columns to have default value set to 1.

Is there no way we can do it in Talend..? Thanks!

Anonymous
Not applicable
Author

Can't you set it to 1 manually? Or you want to read this value from somewhere and set it?
manodwhb
Champion II
Champion II

Can you try in tmap expression like

row1.fieldname== null ? 1 : row1.fieldnam0683p000009LwQo.png

manodwhb
Champion II
Champion II

@KanT,i have tested default value for integer coumn working fine,i believe your file might have spaces,please check.

 

i am attacing input file and screenshoots.

 

0683p000009LwfS.png0683p000009LwYI.png0683p000009LwrD.png

 


test.txt
Anonymous
Not applicable
Author

Hi,

 

So this column is a new column and doesn't exist in the input file but I added it in output file.

so, I add the column in output of tmap. and in Tmap try to set it default value to 1. It doesn't work.

 

can I not set default values in Tmap?

 

0683p000009Lwn2.png

vboppudi
Partner - Creator III
Partner - Creator III

Hi,

 

If you create output column in tMap then use default value in expression.

 

0683p000009Lwt9.png

Regards,

manodwhb
Champion II
Champion II

@KanT,you cannot set the default value for the column which not having input in tmap,

 

since you see harcode the value under Expression of Output section.