<?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: Store GlobalVariable in String array in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203369#M4716</link>
    <description>You always get the last item with this job design, If you want to add each item to string array, to do: 
&lt;BR /&gt;1. Declare an arraylist in the begin part of tJavaFlex. 
&lt;BR /&gt;2. Add each item to the list in the main part of tJavaFlex. 
&lt;BR /&gt;3. In the end part of tJavaFlex, convert the list to string array if needed. 
&lt;BR /&gt; 
&lt;BR /&gt;Regards 
&lt;BR /&gt;Shong</description>
    <pubDate>Wed, 15 Apr 2020 03:14:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-04-15T03:14:23Z</dc:date>
    <item>
      <title>Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203366#M4713</link>
      <description>&lt;P&gt;Hello ,&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Im trying to store a list of 'marketplace_product_id' but im always , but im getting one row&amp;nbsp; (which is not the case )&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="bb.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9Su.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150633i9310660E75CBCCBE/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9Su.png" alt="0683p000009M9Su.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks .&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 13:31:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203366#M4713</guid>
      <dc:creator>kakooo16</dc:creator>
      <dc:date>2020-04-14T13:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203367#M4714</link>
      <description>&lt;P&gt;Hello again ,&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Could i declare an array list using a globalvariable ? .&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Im still blocked please !&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 20:11:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203367#M4714</guid>
      <dc:creator>kakooo16</dc:creator>
      <dc:date>2020-04-14T20:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203368#M4715</link>
      <description>&lt;P&gt;Here is some working code from one of my jobs.&amp;nbsp; It's in a &lt;STRONG&gt;tJavaFlex&lt;/STRONG&gt; which creates an &lt;STRONG&gt;ArrayList&lt;/STRONG&gt; and stores it in a global variable.&amp;nbsp; What the code does is break a large file into blocks based on begin/end tags.&amp;nbsp; It stores a list of the blocks in the ArrayList for use later in the job.&amp;nbsp; You can use this as an example:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Start Code:&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;int i = 0;&lt;BR /&gt;String s;&lt;/P&gt; 
&lt;P&gt;boolean myStart = false;&lt;BR /&gt;boolean myRecCntFlag = false;&lt;/P&gt; 
&lt;P&gt;int startPos;&lt;BR /&gt;int endPos;&lt;BR /&gt;String subS;&lt;/P&gt; 
&lt;P&gt;List&amp;lt;String&amp;gt; listFilenames = new java.util.ArrayList&amp;lt;String&amp;gt;();&lt;BR /&gt;List&amp;lt;Boolean&amp;gt; listmyRecCntFlags = new java.util.ArrayList&amp;lt;Boolean&amp;gt;();&lt;/P&gt; 
&lt;P&gt;globalMap.put("myFilename", "nothing");&lt;BR /&gt;globalMap.put("myRecCntFlag", false);&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Main Code:&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;s = row7.line;&lt;/P&gt; 
&lt;P&gt;if(!myStart) {&lt;BR /&gt;if(s.contains("^^^BREAK-ETL-BEGIN")) {&lt;BR /&gt;myStart = true;&lt;BR /&gt;&lt;BR /&gt;// IndexOf returns -1 if there nothing is found&lt;BR /&gt;startPos = s.indexOf(":");&lt;BR /&gt;endPos = s.indexOf(":", startPos + 1);&lt;BR /&gt;//System.out.println(startPos + "-" + endPos);&lt;BR /&gt;if(startPos&amp;gt;=0 &amp;amp;&amp;amp; endPos&amp;gt;=0 &amp;amp;&amp;amp; startPos &amp;lt; endPos) {&lt;BR /&gt;subS = s.substring(startPos + 1, endPos);&lt;BR /&gt;} else {&lt;BR /&gt;subS = Integer.toString(i);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;subS = subS + ".sql";&lt;BR /&gt;&lt;BR /&gt;listFilenames.add(subS);&lt;BR /&gt;globalMap.put("myFilename", subS);&lt;BR /&gt;s = "";&lt;BR /&gt;i++;&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;if(s.contains("^^^BREAK-ETL-END^^^")) {&lt;BR /&gt;listmyRecCntFlags.add(myRecCntFlag);&lt;BR /&gt;globalMap.put("myRecCntFlag", myRecCntFlag);&lt;/P&gt; 
&lt;P&gt;myStart = false;&lt;BR /&gt;myRecCntFlag = false;&lt;BR /&gt;s = "";&lt;BR /&gt;} else {&lt;BR /&gt;if(s.contains("RecCnt")) {&lt;BR /&gt;myRecCntFlag = true;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt; 
&lt;P&gt;row9.line = s;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;End Code:&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;globalMap.put("myManafestFilenames", listFilenames);&lt;BR /&gt;globalMap.put("myManafestRecCntFlags", listmyRecCntFlags);&lt;/P&gt; 
&lt;P&gt;//System.out.println("test: " + (String)globalMap.get("myFilename"));&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Then a &lt;STRONG&gt;tloop&lt;/STRONG&gt; is used to iterate through the ArrayList like this:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Declaration&lt;/STRONG&gt;:&amp;nbsp;int i=0&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Conndition&lt;/STRONG&gt;:&amp;nbsp;i&amp;lt;((List)globalMap.get("myManafestFilenames")).size()&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Iteration&lt;/STRONG&gt;:&amp;nbsp;i++&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Your value can then be accessed with:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;(String)((List)globalMap.get("myManafestFilenames")).get(((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) - 1)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 23:15:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203368#M4715</guid>
      <dc:creator>billimmer</dc:creator>
      <dc:date>2020-04-14T23:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203369#M4716</link>
      <description>You always get the last item with this job design, If you want to add each item to string array, to do: 
&lt;BR /&gt;1. Declare an arraylist in the begin part of tJavaFlex. 
&lt;BR /&gt;2. Add each item to the list in the main part of tJavaFlex. 
&lt;BR /&gt;3. In the end part of tJavaFlex, convert the list to string array if needed. 
&lt;BR /&gt; 
&lt;BR /&gt;Regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 15 Apr 2020 03:14:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203369#M4716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-15T03:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203370#M4717</link>
      <description>&lt;P&gt;The problem is when i print the value of the global varible as such :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.out.println("Global variable : " + globalMap.get("marketplace_product_id"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is&amp;nbsp; :&amp;nbsp;Global variable : null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am i missing something while putting my variable into tSetGlobalVar ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 08:28:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203370#M4717</guid>
      <dc:creator>kakooo16</dc:creator>
      <dc:date>2020-04-15T08:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203371#M4718</link>
      <description>First, make sure you read data out from memory using tHashInput. 
&lt;BR /&gt;Can you upload a screenshot of basic setting of tSetGlobalVar?
&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Apr 2020 08:31:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203371#M4718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-15T08:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203372#M4719</link>
      <description>&lt;P&gt;Here is a screenshot&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="global.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M9Tn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158320iE1BB3AA31956C0C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M9Tn.png" alt="0683p000009M9Tn.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 08:34:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203372#M4719</guid>
      <dc:creator>kakooo16</dc:creator>
      <dc:date>2020-04-15T08:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203373#M4720</link>
      <description>When i try to declare int i=0 in the tloop component . It is getting me an error int cannot be resolved .</description>
      <pubDate>Wed, 15 Apr 2020 10:08:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203373#M4720</guid>
      <dc:creator>kakooo16</dc:creator>
      <dc:date>2020-04-15T10:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Store GlobalVariable in String array</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203374#M4721</link>
      <description>&lt;P&gt;Make sure you set your tloop type as a "While' loop.&amp;nbsp; Not a for loop.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 14:27:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Store-GlobalVariable-in-String-array/m-p/2203374#M4721</guid>
      <dc:creator>billimmer</dc:creator>
      <dc:date>2020-04-15T14:27:29Z</dc:date>
    </item>
  </channel>
</rss>

