<?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: Iterating through values in table for single Context Variable in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334187#M102873</link>
    <description>This is pretty straight forward. First of all, build a standalone job that will use context variables to set your database connection, carry out the query and load the data. You probably have this given your description.&amp;nbsp;&lt;BR /&gt;Next build another job which will query your db table with your db credentials. Connect a tMySQLInput (with the query) to a tFlowToIterate. Then drag your previous job into this new job. Connect your tFlowToIterate to that job using an "iterate" connector.&lt;BR /&gt;Now, if your row connecting your tMySQLInput to the tFlowToIterate is called "row1" and your column names are "dbname" and "dbpassword" (for example), you need to pass those to the job carrying out the work. In that job you should have created some context variables that correspond to those values being passed in. Go to the properties of the child job and set the context variables of the child job to the values returned by your query. To do this you use globalMap variables. These are created by the tFlowToIterate component. given the details of this example, your dbname value can be passed using the code....&lt;BR /&gt;((String)globalMap.get("row1.dbname"))&lt;BR /&gt;...and....&lt;BR /&gt;((String)globalMap.get("row1.dbpassword"))&lt;BR /&gt;An example of using tRunJob components (child jobs) can be found here (&lt;A href="https://help.talend.com/search/all?query=tRunJob&amp;amp;content-lang=en" rel="nofollow noopener noreferrer"&gt;https://help.talend.com/search/all?query=tRunJob&amp;amp;content-lang=en&lt;/A&gt;).&lt;BR /&gt;In this example the inner job will be run for every row returned by the query returning db details.</description>
    <pubDate>Sun, 26 Mar 2017 04:09:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-26T04:09:52Z</dc:date>
    <item>
      <title>Iterating through values in table for single Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334186#M102872</link>
      <description>Hi there, I'm quite new to Talend and have struggled a bit in finding a good approach for this.&amp;nbsp;
&lt;BR /&gt;My use case is I'd like to iterate over a&amp;nbsp;table of database names to set a context.database variable, so that when a tMySQLInput component runs it will run for `databaseA` then shoots data to a common target, then the database variable would be overwritten&amp;nbsp;by the next in the list `databaseB` and so on.
&lt;BR /&gt;I've experimented a bit with the tContextLoad and am able to get that to set a database name for a single entry - but am wondering how to iterate over multiple rows of the same key values from a table source. Not seeing a good way to get this to accept an iterated value.&amp;nbsp;
&lt;BR /&gt;My source table for setting the variables would look like this:&amp;nbsp;
&lt;BR /&gt;|key|value|&amp;nbsp;
&lt;BR /&gt;|database|databaseA|
&lt;BR /&gt;|database|databaseB|
&lt;BR /&gt;Thanks for any help!</description>
      <pubDate>Sat, 25 Mar 2017 20:18:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334186#M102872</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-25T20:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating through values in table for single Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334187#M102873</link>
      <description>This is pretty straight forward. First of all, build a standalone job that will use context variables to set your database connection, carry out the query and load the data. You probably have this given your description.&amp;nbsp;&lt;BR /&gt;Next build another job which will query your db table with your db credentials. Connect a tMySQLInput (with the query) to a tFlowToIterate. Then drag your previous job into this new job. Connect your tFlowToIterate to that job using an "iterate" connector.&lt;BR /&gt;Now, if your row connecting your tMySQLInput to the tFlowToIterate is called "row1" and your column names are "dbname" and "dbpassword" (for example), you need to pass those to the job carrying out the work. In that job you should have created some context variables that correspond to those values being passed in. Go to the properties of the child job and set the context variables of the child job to the values returned by your query. To do this you use globalMap variables. These are created by the tFlowToIterate component. given the details of this example, your dbname value can be passed using the code....&lt;BR /&gt;((String)globalMap.get("row1.dbname"))&lt;BR /&gt;...and....&lt;BR /&gt;((String)globalMap.get("row1.dbpassword"))&lt;BR /&gt;An example of using tRunJob components (child jobs) can be found here (&lt;A href="https://help.talend.com/search/all?query=tRunJob&amp;amp;content-lang=en" rel="nofollow noopener noreferrer"&gt;https://help.talend.com/search/all?query=tRunJob&amp;amp;content-lang=en&lt;/A&gt;).&lt;BR /&gt;In this example the inner job will be run for every row returned by the query returning db details.</description>
      <pubDate>Sun, 26 Mar 2017 04:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334187#M102873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-26T04:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating through values in table for single Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334188#M102874</link>
      <description>Thanks! I actually came to the same solution yesterday. Didn't realize the tFlowtoIterate component's purpose was setting global variables. Again, pretty new to this as I come from SSIS world so a lot to learn.&amp;nbsp; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&amp;nbsp;</description>
      <pubDate>Sun, 26 Mar 2017 22:04:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334188#M102874</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-26T22:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Iterating through values in table for single Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334189#M102875</link>
      <description>The tFlowToIterate is not really meant to set globalMap variables. It is meant to take a flow and iterate each row enabling the following subjob to run completely for each row. However, it achieves this by setting the row to globalMap variables. A useful trick to remember &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Sun, 26 Mar 2017 22:12:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterating-through-values-in-table-for-single-Context-Variable/m-p/2334189#M102875</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-26T22:12:08Z</dc:date>
    </item>
  </channel>
</rss>

