<?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 an array and pass it to a tRestClient component in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520899#M147644</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/274551"&gt;@Dave_Simo&lt;/a&gt;&amp;nbsp;, thank you so much for your response.&lt;BR /&gt;&lt;BR /&gt;I get a string with article numbers from&amp;nbsp;&lt;SPAN&gt;globalMap.get("linkedPimArticlesFilterParam").&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;It looks like this:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0927000004,0927100004,0927150004,09271500041,0940000004,0940100004,0940150004,0941000005,09410000051,0941000085,09410000A3,0941100005,09411000051,0941100085,09411000851,0941100092,09411000A3,0941150005,0941150085,09411500A3,0944000005,09440000051,0944000085,09440000851,0944003200,0944003205,0944003285,0944000002,09440000021,0944100005,09441000051,0944100085,09441000851,0944103200,0944103285,0944103205,09441000021,0944100002,0944150005,0944150085,09441500851,09441500051,09441500941,0944150094,0944153205,09530000852,09530000052,09530000022,09531000852,09531000052,09531000022,09531500852,09531500052,0953150094,095700AC85,095700CB00,0957003200,0957000000,095700AM85,095700CB85,0957003285,095700AA85,0957000085,095700AC05,095700AA05,095700AM05,0957103285,095710CB85,095710AM85,0957100000,095710CB00,0957103200,095710AC85,095710AA85,0957100085,095710AC05,095710AA05,095710AM05,095715AM85,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;I want to pass them as a Query parameter in my tRESTClient like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HungryOctopus_0-1749656734358.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181252i258984B0C411F1F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HungryOctopus_0-1749656734358.png" alt="HungryOctopus_0-1749656734358.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The problem is that the REST API has a limitation for the numbers of characters that you can send at the same time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So I want to cut it in batches of a defined length, then pass it batch to batch.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So my talend job should count if the original string has more than 100 characters, if yes pass it&amp;nbsp;&lt;/P&gt;&lt;P&gt;If no, prepare batches of 100 characters or less without cutting an article number in the middle.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Then pass it to the tRestClient one batch after the other.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I hope this makes sense, if you have any questions please let me know.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jun 2025 15:50:29 GMT</pubDate>
    <dc:creator>HungryOctopus</dc:creator>
    <dc:date>2025-06-11T15:50:29Z</dc:date>
    <item>
      <title>Iterate on an array and pass it to a tRestClient component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2519724#M147614</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;I am struggling with an issue in Talend.&lt;/P&gt;&lt;P&gt;I want to process a string of numbers separated with a comma in a tRestClient component. Since the REST API has a limitation of 100 characters, I want to check if it's longer, than create batches of the request, then iterate on it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I built the job like this, but it doesn't iterate.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="How I built the job" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/180948i6311CFDD122474EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="tRest.JPG" alt="How I built the job" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;How I built the job&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is the code in the tjavarow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;// Get the string from global map (only on first execution)
if (globalMap.get("batchList") == null) {
String linkedPimArticlesFilterParam = (String) globalMap.get("linkedPimArticlesFilterParam");

// Split the string by comma
String[] numbers = linkedPimArticlesFilterParam.split(",");

// Create batches
java.util.List&amp;lt;String&amp;gt; batches = new java.util.ArrayList&amp;lt;String&amp;gt;();
StringBuilder currentBatch = new StringBuilder();

for (String number : numbers) {
String trimmedNumber = number.trim();

String potentialBatch = currentBatch.length() == 0 ?
trimmedNumber : currentBatch.toString() + "," + trimmedNumber;

if (potentialBatch.length() &amp;lt;= 100) {
if (currentBatch.length() &amp;gt; 0) {
currentBatch.append(",");
}
currentBatch.append(trimmedNumber);
} else {
if (currentBatch.length() &amp;gt; 0) {
batches.add(currentBatch.toString());
}
currentBatch = new StringBuilder(trimmedNumber);
}
}

if (currentBatch.length() &amp;gt; 0) {
batches.add(currentBatch.toString());
}

globalMap.put("batchList", batches);
globalMap.put("currentBatchIndex", 0);
}

// Get current batch
java.util.List&amp;lt;String&amp;gt; batches = (java.util.List&amp;lt;String&amp;gt;)globalMap.get("batchList");
Integer currentIndex = (Integer)globalMap.get("currentBatchIndex");

if (currentIndex &amp;lt; batches.size()) {
String currentBatch = batches.get(currentIndex);
globalMap.put("currentBatchData", currentBatch);
globalMap.put("currentBatchIndex", currentIndex + 1);

System.out.println("Processing batch " + (currentIndex + 1) + " of " + batches.size() + ": " + currentBatch);
} else {
// No more batches to process
globalMap.put("currentBatchData", null);
}

System.out.println("Current batch for REST call: " + (String)globalMap.get("currentBatchData"));&lt;/LI-CODE&gt;&lt;P&gt;This is the key in the tFlowToIterate: (String)globalMap.get("currentBatch")&lt;/P&gt;&lt;P&gt;The tjavaflex does nothing, it is just to have something to link to the trest with a main row.&lt;/P&gt;&lt;P&gt;It seems I can't directly link any iteration component to the tRest.&lt;/P&gt;&lt;P&gt;I'm grateful for any help!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 07:21:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2519724#M147614</guid>
      <dc:creator>HungryOctopus</dc:creator>
      <dc:date>2025-06-02T07:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on an array and pass it to a tRestClient component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520876#M147639</link>
      <description>&lt;P&gt;Hey together,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anyone that can help me on this? The AI couldn't help me so fellow humans, it's your time to shine &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 13:19:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520876#M147639</guid>
      <dc:creator>HungryOctopus</dc:creator>
      <dc:date>2025-06-11T13:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on an array and pass it to a tRestClient component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520884#M147641</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/288876"&gt;@HungryOctopus&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Could you give an example of what you want to do as an iterative loop? It's a loop with a maximum length of 100 characters in the parameter when calling tResClient if I understand correctly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 14:41:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520884#M147641</guid>
      <dc:creator>Dave_Simo</dc:creator>
      <dc:date>2025-06-11T14:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on an array and pass it to a tRestClient component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520899#M147644</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/274551"&gt;@Dave_Simo&lt;/a&gt;&amp;nbsp;, thank you so much for your response.&lt;BR /&gt;&lt;BR /&gt;I get a string with article numbers from&amp;nbsp;&lt;SPAN&gt;globalMap.get("linkedPimArticlesFilterParam").&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;It looks like this:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0927000004,0927100004,0927150004,09271500041,0940000004,0940100004,0940150004,0941000005,09410000051,0941000085,09410000A3,0941100005,09411000051,0941100085,09411000851,0941100092,09411000A3,0941150005,0941150085,09411500A3,0944000005,09440000051,0944000085,09440000851,0944003200,0944003205,0944003285,0944000002,09440000021,0944100005,09441000051,0944100085,09441000851,0944103200,0944103285,0944103205,09441000021,0944100002,0944150005,0944150085,09441500851,09441500051,09441500941,0944150094,0944153205,09530000852,09530000052,09530000022,09531000852,09531000052,09531000022,09531500852,09531500052,0953150094,095700AC85,095700CB00,0957003200,0957000000,095700AM85,095700CB85,0957003285,095700AA85,0957000085,095700AC05,095700AA05,095700AM05,0957103285,095710CB85,095710AM85,0957100000,095710CB00,0957103200,095710AC85,095710AA85,0957100085,095710AC05,095710AA05,095710AM05,095715AM85,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;I want to pass them as a Query parameter in my tRESTClient like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HungryOctopus_0-1749656734358.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181252i258984B0C411F1F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HungryOctopus_0-1749656734358.png" alt="HungryOctopus_0-1749656734358.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The problem is that the REST API has a limitation for the numbers of characters that you can send at the same time.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So I want to cut it in batches of a defined length, then pass it batch to batch.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So my talend job should count if the original string has more than 100 characters, if yes pass it&amp;nbsp;&lt;/P&gt;&lt;P&gt;If no, prepare batches of 100 characters or less without cutting an article number in the middle.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Then pass it to the tRestClient one batch after the other.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I hope this makes sense, if you have any questions please let me know.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 15:50:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520899#M147644</guid>
      <dc:creator>HungryOctopus</dc:creator>
      <dc:date>2025-06-11T15:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on an array and pass it to a tRestClient component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520911#M147646</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/288876"&gt;@HungryOctopus&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I now understand what you want to do and I suggest the design of the job below to cut into batches of 100 and group with a tAggregateRow then loop with a tFlowToIterate to call the tResclient as many as necessary.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dave_Simo_0-1749659923022.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181256i0440B5C0639037CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dave_Simo_0-1749659923022.png" alt="Dave_Simo_0-1749659923022.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dave_Simo_1-1749660229319.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181257i7A3B41D654058E49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dave_Simo_1-1749660229319.png" alt="Dave_Simo_1-1749660229319.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dave_Simo_2-1749660246758.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181258i25FAFE300780CEE2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dave_Simo_2-1749660246758.png" alt="Dave_Simo_2-1749660246758.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dave_Simo_3-1749660281801.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181259iC4B511213CC89012/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dave_Simo_3-1749660281801.png" alt="Dave_Simo_3-1749660281801.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dave_Simo_0-1749660723652.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181261iFFA25E375245D9C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dave_Simo_0-1749660723652.png" alt="Dave_Simo_0-1749660723652.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dave_Simo_4-1749660312886.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181260i01902181DAB14237/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dave_Simo_4-1749660312886.png" alt="Dave_Simo_4-1749660312886.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 16:52:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520911#M147646</guid>
      <dc:creator>Dave_Simo</dc:creator>
      <dc:date>2025-06-11T16:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate on an array and pass it to a tRestClient component</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520981#M147649</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/274551"&gt;@Dave_Simo&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I made some slight changes, at the end my job looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HungryOctopus_0-1749713560672.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/181271i78880805E0E81A51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HungryOctopus_0-1749713560672.png" alt="HungryOctopus_0-1749713560672.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The tRestClient reads the data from row44. And it's working!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 07:35:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Iterate-on-an-array-and-pass-it-to-a-tRestClient-component/m-p/2520981#M147649</guid>
      <dc:creator>HungryOctopus</dc:creator>
      <dc:date>2025-06-12T07:35:26Z</dc:date>
    </item>
  </channel>
</rss>

