Creating global variable from external file

Highlighted
Six Stars

Creating global variable from external file

Hi All,

I am new to talend. I am trying to find out the way to create global variables automatically from the external file.

If anyone has already faced this scenario.


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: Creating global variable from external file

Suppose you have a CSV file with fields key and value. Connect a tFileInputDelimited to a tSetGlobalVar. Add Aline into the variable array and enter row1.key for the key field and row1.value for the value.
When you will run that job, you have 1 variable for each input file record.

TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Creating global variable from external file

Suppose you have a CSV file with fields key and value. Connect a tFileInputDelimited to a tSetGlobalVar. Add Aline into the variable array and enter row1.key for the key field and row1.value for the value.
When you will run that job, you have 1 variable for each input file record.

TRF
Moderator

Re: Creating global variable from external file

Hello,

Could you please let us know if this scenario helps?

TalendHelpCenter:Reading data from different MySQL databases using dynamically loaded connection par...

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Creating global variable from external file

Hi Sabrina , Thanks for your quick reply. I went through the link but there contextload is being used to export the variable but in my case I am not able to use contextload because I am not able to access context varibale in RUN IF trigger link, but global variables are accessible there, so I am going with global variables. 

Fifteen Stars TRF
Fifteen Stars

Re: Creating global variable from external file

tContextLoad should work if you want to load context variables - don't know why you can't use a context variable in a If trigger expression.

However, as you were asking for a solution for global variables, my previous answer should help you.


TRF
Six Stars

Re: Creating global variable from external file

i have a job todo this , and run prejob on all job for initialization (cf screens)
Six Stars

Re: Creating global variable from external file

Thanks All for the help, TRF's solution worked out as I am using global variable. I will explore contextload as well, why I am not able to access context variable in run if trigger.  

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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog