<?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 on a list of values in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258679#M40409</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you throw some light on this simple scenario...I am sure people working in Talend would have come across this situation, please spend a minute to read.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2019 14:41:37 GMT</pubDate>
    <dc:creator>tnewbie</dc:creator>
    <dc:date>2019-09-24T14:41:37Z</dc:date>
    <item>
      <title>Iterate on a list of values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258676#M40406</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I need to count the number of occurrences of certain predefined strings (but these may increase or decrease so want to make it data driven or file driven) against every line of incoming data (data coming in a file).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;To explain further:&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;For each of this incoming lines of data i have to check the count of certain strings like&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;"ABC",&amp;nbsp;"XYZ" ,"AAABC","UCAD1","DDEZY"&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;my incoming data is something like this:&lt;/P&gt; 
&lt;P&gt;California,ABC,123,Oct23Purview,ABCD,ABC,A,B,XYZ,UCAD1,ABC,DD,UCAD2,UCAD1&amp;nbsp; ---&amp;gt; line 1&lt;BR /&gt;Houston,XYZ,XYZ,Jan21Conclusion,ABC,AB,XYZ,XYZD,ABC,IDE123,IDE870,ABD,UCAD1 --&amp;gt; line 2&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Output i am looking for is:&lt;/P&gt; 
&lt;P&gt;line 1 --ABC =3, XYZ = 1, AAABC=0,UCAD1=1, DDEZY=0&lt;/P&gt; 
&lt;P&gt;line 2 --ABC=2,XYZ=3 ,AAABC=0 ,UCAD1=1, DDEZY=0&lt;/P&gt; 
&lt;P&gt;Any thoughts please?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:36:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258676#M40406</guid>
      <dc:creator>tnewbie</dc:creator>
      <dc:date>2024-11-16T04:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on a list of values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258677#M40407</link>
      <description>&lt;P&gt;Use Collections.frequency&lt;/P&gt;
&lt;PRE&gt;String [] strs = new String[] {"ABC", "XYZ" ,"AAABC","UCAD1","DDEZY"};

ArrayList&amp;lt;String&amp;gt; ll = new ArrayList&amp;lt;&amp;gt;();

for (String s : strs){
	ll.add(s + "=" + Collections.frequency(Arrays.asList(row1.data.split(",")),s));
}

System.out.println(String.join(",", ll)); //ABC=3,XYZ=1,AAABC=0,UCAD1=2,DDEZY=0&lt;BR /&gt;                                          //ABC=2,XYZ=3,AAABC=0,UCAD1=1,DDEZY=0&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Sep 2019 21:06:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258677#M40407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-23T21:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on a list of values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258678#M40408</link>
      <description>&lt;P&gt;Hello evansdar, can you elaborate a bit, as to how you envision the solution&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 01:00:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258678#M40408</guid>
      <dc:creator>tnewbie</dc:creator>
      <dc:date>2019-09-24T01:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on a list of values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258679#M40409</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you throw some light on this simple scenario...I am sure people working in Talend would have come across this situation, please spend a minute to read.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 14:41:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258679#M40409</guid>
      <dc:creator>tnewbie</dc:creator>
      <dc:date>2019-09-24T14:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on a list of values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258680#M40410</link>
      <description>&lt;P&gt;Not sure what you're expecting here. My code does what you're asking, what more do you need?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 19:53:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258680#M40410</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-24T19:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on a list of values</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258681#M40411</link>
      <description>&lt;P&gt;Hello evansdar,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks for the time spent...I am an ETL person and i look for data driven approaches, as such i am not a Java person, so your proposed solution looks little constrained to me because the way you tried to push the strings into an array&amp;nbsp;{"ABC", "XYZ" ,"AAABC","UCAD1","DDEZY"}; will confine the solution if I have to add / remove strings at a later point in time....also being a non-java person i didn't know how to include your code (probably a tjavaflex would have served the purpose, but i am not sure) .&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I did move forward with a work around where i had all the strings as separate text files and used a tFileList which can dynamically source these values and play around with a context variable...though i could achieve the result, i am not personally convinced with the approach so was looking around to see if some other brains might have a better solution.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks again&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Lwoe"&gt;my_solution.png&lt;/A&gt;</description>
      <pubDate>Tue, 24 Sep 2019 23:12:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-a-list-of-values/m-p/2258681#M40411</guid>
      <dc:creator>tnewbie</dc:creator>
      <dc:date>2019-09-24T23:12:39Z</dc:date>
    </item>
  </channel>
</rss>

