How to write context variable dynamically to tFileInputDelimited

Highlighted
Six Stars

How to write context variable dynamically to tFileInputDelimited

Hi, 

 

Below is my job design, 

 

tFileInputDelimited_1 -> tFlowtoIterate_1 -> tJavaFlex -> tFileInputDelimited_2 -> tJavaRow -> tFlowtoIterate_2 -> tHiveInput -> tFileOutputDelimited_1

 

 

I am setting a context variable as below in the tJavaRow. 

 

 

System.out.println("Value Of Input: "+input_row.table_name);
globalMap.put("varTOP", input_row.table_name);
System.out.println("Value Of GlobalVar: "+globalMap.get("table_name"));

My problem is, 

 

 

I need to send the context value of "table_name" dynamically to tFileOutputDelimited_1 and append along with each output record. 

eg:-<table_name>-<result_set> ( i am using the delimiter as "-")

emp-1-firstname-lastname-3545-address-phone-email

dept-1-hghg-jkh-546-dpet-trtr

..

..

 

Please suggest how to send that contextVariable and append in the tFileOutputDelimited. 

Fifteen Stars TRF
Fifteen Stars

Re: How to write context variable dynamically to tFileInputDelimited

Why don't you add a pseudo-column to your query with the tablename?

select 'EMP', code, firstname, lastname from EMP;

 


TRF
Seven Stars

Re: How to write context variable dynamically to tFileInputDelimited

just add one more column in tjavarow schema and set its value using globalMap.get("table_name") ,

pass this flow as it is to tFlowToIterate and sync this schema to tHive and tfileoutputDelimited

Six Stars

Re: How to write context variable dynamically to tFileInputDelimited

@TRF @CK395

 

Sorry for the delay in the response.

 

Thanks @TRF - This is working for me, Surprising that, i missed this simple tweak. 

 

@CK395 - I will work on your reply as well, and i will let you know, if that is working

Fifteen Stars TRF
Fifteen Stars

Re: How to write context variable dynamically to tFileInputDelimited

Great!
@marskid4u, thanks to mark your case as solved

TRF

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now