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: 
mdeeter
Contributor
Contributor

Trouble with tJavaRow adding a column to the Dynamic

Hi all, I have a Talend enterprise job that is fairly resusable.  One of the main functions of this job is to map column dynamically to a common output layout for PII data to be used in later steps.

 

I am struggling with the syntax to append a net new column to the dynamic column that is coming into the tJavarow.

 

I have the mapping of varied input data figured out but I can't seem to initialize the column so I can map data to it.  Note, this works if I add the column in a prior step and just leaving the source blank (i.e. in tMap) and then use a tWriteDynamic prior to the tJavarow but I am hoping to keep this complexity all in the tJavarow component.  Is there something wrong with this syntax?  I am not getting the column back in the output_row in the next component.

 

Any ideas:

 

Dynamic CDI_Schema = input_row.CdiData;


for (int i = 0; i < CDI_Schema_1.getColumnCount(); i++)
{
DynamicMetadata columnMetadata = CDI_Schema.getColumnMetadata(i);
{CDI_Schema.addColumn("input_first_name" ,"String", true);}

 

if (columnMetadata.getName().equals("input_first_name"                )){CDI_Schema.setColumnValue(i,CDI_Schema.getColumnValue((String)globalMap.get("input_first_name_column")));}

 

}

output_row.CdiData  = CDI_Schema;

 

Labels (3)
3 Replies
mdeeter
Contributor
Contributor
Author

Anyone have experience with addColumn and a Dynamic column?

mdeeter
Contributor
Contributor
Author

Hi, anyone have any suggestions on this?

User5923427525177642
Contributor
Contributor

Hi mdeeter,

 

 

 

CDI_Schema.addColumn("input_first_name" ,"String", true) is not a void type but a dynamic type.

 

This one returns you CDI_Schema's value with added column.

 

 

 

So you have to write it like this : CDI_Schema = CDI_Schema.addColumn("input_first_name" ,"String", true);