How to set default integer value for a column

Six Stars

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!

 

15.png

Community Manager

Re: How to set default integer value for a column

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

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: How to set default integer value for a column

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!

Community Manager

Re: How to set default integer value for a column

Can't you set it to 1 manually? Or you want to read this value from somewhere and set it?
----------------------------------------------------------
Talend | Data Agility for Modern Business
Thirteen Stars

Re: How to set default integer value for a column

Can you try in tmap expression like

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

Manohar B
Thirteen Stars

Re: How to set default integer value for a column

@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.

 

Untitled.pngUntitled.pngUntitled.png

 

Manohar B
Six Stars

Re: How to set default integer value for a column

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?

 

16.png

Nine Stars

Re: How to set default integer value for a column

Hi,

 

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

 

Default.PNG

Regards,

Veeru Boppudi
Thirteen Stars

Re: How to set default integer value for a column

@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.

Manohar B

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.