Iterate CSV file to set context variables for each row

Highlighted
Four Stars

Iterate CSV file to set context variables for each row

Hi,
I am trying to set context variable values from csv file columns, i.e. each column has value for a context variable, any comments on how to do that ?

Forteen Stars

Re: Iterate CSV file to set context variables for each row

csv file must have only 2 columns one with name "key", second with name "value"
each row contain 1 key and 1 value
-----------
Four Stars

Re: Iterate CSV file to set context variables for each row

Thanks Vapukov for reply , Actually I need 4 columns to be substituted into 4 variable in one iteration, I tried that method using a properties files and tcontextLoad but it does not fulfill requirements
Forteen Stars

Re: Iterate CSV file to set context variables for each row

sorry, can understand - what is You problem with normal tContextLoad? I load 100 variables at one iteration

all simple:
[list=*]
  • plain csv file - JUST 2 columns "key","value", as many rows as You need - 4-6-10-999

  • tFileInputDelimited -> connect to next by Main connection

  • tContextLoad

  • -----------
    Four Stars

    Re: Iterate CSV file to set context variables for each row

    thanks vapukov , really appreciated your reply, I understand we can set all context variables using key value map into context load but my problem is i need to iterate this for 20 times and in each execution new values will be assigned to 4 variables. so i am trying to iterate csv file with 4 columns and 20 rows.
    Forteen Stars

    Re: Iterate CSV file to set context variables for each row

    think You mix context and normal csv file

    why just not define csv file - as many columns as You need
    than tFileInputCSV -> tFlowToIterate -> and use Your 1000 variables as You want

    Context is context, and do not try to use it wrong
    -----------
    Four Stars

    Re: Iterate CSV file to set context variables for each row

    I have created separate file for each job and then used tFileList-->iterate-->tFileInputDelimited-->tContextLoad. 
    thanks for your time Smiley Happy

    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 4

    Pick up some tips and tricks with Context Variables

    Blog

    How Media Organizations Achieved Success with Data Integration

    Learn how media organizations have achieved success with Data Integration

    Read

    Why Companies Move to the Cloud: 7 Success Stories

    Learn how and why companies are moving to the Cloud

    Read Now