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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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. 

Labels (3)
4 Replies
TRF
Champion II
Champion II

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

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

 

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

@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

TRF
Champion II
Champion II

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