<?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: Iterate through HashMap in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255550#M38218</link>
    <description>What do you expect?</description>
    <pubDate>Fri, 05 May 2017 20:19:25 GMT</pubDate>
    <dc:creator>TRF</dc:creator>
    <dc:date>2017-05-05T20:19:25Z</dc:date>
    <item>
      <title>Iterate through HashMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255549#M38217</link>
      <description>&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following is my scenario,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Map&amp;lt;String, HashSet&amp;lt;String&amp;gt;&amp;gt; iB = new HashMap&amp;lt;String, HashSet&amp;lt;String&amp;gt;&amp;gt;();&lt;/P&gt;&lt;P&gt;if(!iB.containsKey(row5.i)){&lt;BR /&gt;iB.put(row5.i,new HashSet&amp;lt;String&amp;gt;());&lt;BR /&gt;}&lt;BR /&gt;iB.get(row5.i).add(row5.c);&lt;/P&gt;&lt;P&gt;globalMap.put("iBMap", iB);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for(String i:globalMap.get("iBMap".keySet())){&lt;/P&gt;&lt;P&gt;row10.issue = i;&lt;BR /&gt;StringBuilder sb = new StringBuilder();&lt;BR /&gt;for(String c : globalMap.get("&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;BMap&lt;/SPAN&gt;").get(i)) {&lt;BR /&gt;sb.append("'").append(cusip).append("'").append(",");&lt;BR /&gt;row10.color=c;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone give some opinions that the reason why this can't go through?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 09:49:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255549#M38217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T09:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through HashMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255550#M38218</link>
      <description>What do you expect?</description>
      <pubDate>Fri, 05 May 2017 20:19:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255550#M38218</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-05-05T20:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through HashMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255551#M38219</link>
      <description>&lt;P&gt;Thanks for your reply, TRF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My expectation is passing the value of HashMap(In my case it's a HashSet) to row10..&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 20:21:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255551#M38219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-05T20:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through HashMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255552#M38220</link>
      <description>You should try to expose your use case with sample data and expected result.&lt;BR /&gt;</description>
      <pubDate>Fri, 05 May 2017 20:56:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255552#M38220</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-05-05T20:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through HashMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255553#M38221</link>
      <description>&lt;P&gt;You should also give us a hint as to your job structure and any error messages.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Just from looking at your code, you're not casting your globalMap.get() results to the appropriate type. &amp;nbsp;The get() method returns type Object, so you should cast to the right type if you want to use applicable methods.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;You also need to get the object before you can operate on it. &amp;nbsp;This means&amp;nbsp;&lt;SPAN&gt;globalMap.get("iBMap".keySet()) won't work, but (Map)globalMap.get("iBMap").keySet() should.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;Also, since you appear to be using a custom code component, you should get() iBMap once, operate on the local object, and then put() it when finished to save changes. (i.e. assign (Map)globalMap.get("iBMap") to a local variable and loop over it, retrieving keys and values from it rather than constantly getting the object from globalMap).&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;All that said, this type of setup doesn't really leverage Talend's strengths. &amp;nbsp;With a more general explanation of your use case, we may be able to suggest an approach that doesn't involve custom Java code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 21:20:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255553#M38221</guid>
      <dc:creator>cterenzi</dc:creator>
      <dc:date>2017-05-05T21:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through HashMap</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255554#M38222</link>
      <description>&lt;P&gt;Thanks so much, it works!&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 21:24:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-through-HashMap/m-p/2255554#M38222</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-05T21:24:55Z</dc:date>
    </item>
  </channel>
</rss>

