<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Run a job looping through all defined contexts? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329115#M98332</link>
    <description>Thanks for the swift reply.&lt;BR /&gt;&lt;BR /&gt;I did try tContextLoad with tFileInputDelimited but couldn't think how to iterate through the rows and do my processing one at a time.&lt;BR /&gt;&lt;BR /&gt;Also a bit confused with the context groups. Should I create a group per variable I want to dynamically change and have a tContextLoad for each or can I have one for the 4 variables I am looping through (1 for client in file name, 1 for campaign in file name, 1 for gsheet file ID and one for gsheet sheet name)?</description>
    <pubDate>Thu, 13 Jul 2017 23:11:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-07-13T23:11:46Z</dc:date>
    <item>
      <title>Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329113#M98330</link>
      <description>&lt;P&gt;I have a job where I am grabbing a most recent file in Box, unarchiving it and then appending data from the file (.csv) to a Google Sheet.&lt;/P&gt; 
&lt;P&gt;For ease of set up all the reports for different clients are going in one directory. I have defined using contexts filenames to use as a mask as well as google sheet file IDs and Sheet Names.&lt;/P&gt; 
&lt;P&gt;So when I want to update a particular report I select its context and run the job which works fine and as intended.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;What I want to do is to automate running my job with all the contexts I've defined - I'm quite new with Talend so struggling to find how to do this?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 19:39:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329113#M98330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T19:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329114#M98331</link>
      <description>&lt;P&gt;A Context Group is a functional element in Talend to group a set of context variable values. &amp;nbsp; The actual context group name is not passed down into the job, but instead the context variable values are. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hence, instead of passing the values to the job, you need to think of loading the values dynamically at runtime. &amp;nbsp;You can use a tFileInputDelimited to read a file with 2 columns, i.e. Key, Value, and then push that row into a tContextLoad component. &amp;nbsp;This will override the values of the context variables in the current job. &amp;nbsp;You will have as many properties as context groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At runtime, you will loop and dynamically load context variables from 1 properties file, do your processing, and then load the next set of context variable values and do your processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The 2 components you need to look at are tLoop and tContextLoad.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 22:53:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329114#M98331</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T22:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329115#M98332</link>
      <description>Thanks for the swift reply.&lt;BR /&gt;&lt;BR /&gt;I did try tContextLoad with tFileInputDelimited but couldn't think how to iterate through the rows and do my processing one at a time.&lt;BR /&gt;&lt;BR /&gt;Also a bit confused with the context groups. Should I create a group per variable I want to dynamically change and have a tContextLoad for each or can I have one for the 4 variables I am looping through (1 for client in file name, 1 for campaign in file name, 1 for gsheet file ID and one for gsheet sheet name)?</description>
      <pubDate>Thu, 13 Jul 2017 23:11:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329115#M98332</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T23:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329116#M98333</link>
      <description>&lt;P&gt;The Context and Context Groups are just logical grouping of your context variables at design time. &amp;nbsp;They do not impact the way the code are generated.&lt;/P&gt;&lt;P&gt;If you have 10 variables across all contexts, &amp;nbsp;then you need 10 variables in the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I generally create a file like this:&lt;/P&gt;&lt;P&gt;variable1=value1&lt;/P&gt;&lt;P&gt;variable2=value2&lt;/P&gt;&lt;P&gt;Just like a properties file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can use tFileInputDelimited to load the data in 2 columns key, value, with column separator = and new line separator.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have a key in your file and it matches a context variable, the value is set. &amp;nbsp;If the variable does not exist, you get either a warning or error depending on your tContextLoad settings. &amp;nbsp;If you do not specifiy a value for a variable in the file, the value of the variable in the job is not overridden.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 23:19:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329116#M98333</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T23:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329117#M98334</link>
      <description>Thanks for the tips, I'll have a play around tomorrow as hasn't still quite all fit together in my head.
&lt;BR /&gt;Specifically with the context file, does it mean I need a file for each of the Contexts I want to load? I.e. I can't have more than one value per variable in the same file and iterate through them one at a time?
&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jul 2017 23:23:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329117#M98334</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T23:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329118#M98335</link>
      <description>&lt;P&gt;It is up to you to decide how to store the values. &amp;nbsp;You can use a normal CSV format with 3 columns and do data integration basically. &amp;nbsp;You load all the data, filter on a column, and then push the key, value to the tContextLoad component.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tFileInputDelimited -&amp;gt; tMap - &amp;gt; tContextLoad&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 23:26:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329118#M98335</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-13T23:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Run a job looping through all defined contexts?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329119#M98336</link>
      <description>&lt;P&gt;Hi there, can you kindly help me a bit more?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;After lots of different non working options with different components (tLoop, tJavaFlex) I think I've got the closest I've been to a working solution with the below.&lt;/P&gt; 
&lt;P&gt;You can see the code in the tJava that is running my loop below.&lt;/P&gt; 
&lt;P&gt;It basically works fine and loads my first set of context variables as intended but then when the child job connected to this one finishes the whole job ends.&lt;/P&gt; 
&lt;P&gt;I tried using a trigger from component/s in the child job to connect to tJava_3 and make it run again but that's not allowed.&lt;/P&gt; 
&lt;P&gt;Any tips?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2017-07-14 at 19.21.29.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LvR5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152365i732BC7B701698EC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LvR5.png" alt="0683p000009LvR5.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;System.out.println("tJava_3: Start code");
for(int i = 1; i &amp;lt; 2 &amp;amp;&amp;amp; i&amp;lt;((Integer)globalMap.get("doneIteration")); i++)
{globalMap.put("currentIteration", i);
Integer currentIteration = i;
System.out.println("Current Iteration is: " +currentIteration);
System.out.println("tJava_3: Main code: i=" + i);
    }
System.out.println("tJava_3: End code");&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jul 2017 19:28:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Run-a-job-looping-through-all-defined-contexts/m-p/2329119#M98336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-14T19:28:22Z</dc:date>
    </item>
  </channel>
</rss>

