<?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: Loop over Web Service in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318941#M89237</link>
    <description>&lt;P&gt;Glad it also worked and thankyou for explaining your way also.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 06:25:42 GMT</pubDate>
    <dc:creator>Prakhar1</dc:creator>
    <dc:date>2021-01-18T06:25:42Z</dc:date>
    <item>
      <title>Loop over Web Service</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318937#M89233</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an issue to use a loop to get some Data from a Rest API. I want to run the request until the status field in my response is "completed_ok". If the status is "in_progress" I want to continue. I have no problem to get those fields but I don't know how to configure the loop.  I would like to set a Boolean global variable to "true" just before the loop, run the web service and then set this variable to false when I get my correct status and make the loop to stop. My problem is that I don't know how to include the web service inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help !&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDE31AAH.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153284iF837A699735ECAA0/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDE31AAH.png" alt="0693p00000BDE31AAH.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDE5CAAX.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152253i90C2DCAC7EEC92FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDE5CAAX.png" alt="0693p00000BDE5CAAX.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2021 15:03:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318937#M89233</guid>
      <dc:creator>GerJea</dc:creator>
      <dc:date>2021-01-16T15:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over Web Service</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318938#M89234</link>
      <description>&lt;P&gt;Hello, I managed to solve my problem using empty tJava and On_component_ok trigger. I hope this solution can help someone!&lt;/P&gt;&lt;P&gt;First part of the job:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSRWAA5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130679iC58C64A875E3CA59/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSRWAA5.png" alt="0693p00000BDSRWAA5.png" /&gt;&lt;/span&gt;First, I'm putting my input flow into a global variable.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSXtAAP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134403i49A32ED32E8A6A04/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSXtAAP.png" alt="0693p00000BDSXtAAP.png" /&gt;&lt;/span&gt;Then I will iterate until the condition on my loop is respected, the global variable "Status Assistant" will be null at the beginning so it will iterate. &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSNUAA5.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130520i6402811803C4A37F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSNUAA5.png" alt="0693p00000BDSNUAA5.png" /&gt;&lt;/span&gt;Then using the trigger On_component_ok and two emtpy tJava, I can retrieve the input flow that I stored in a global variable and run the web service to get my status.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSbCAAX.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/144368iC4A6FF9163FCE8BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSbCAAX.png" alt="0693p00000BDSbCAAX.png" /&gt;&lt;/span&gt;Second part of the job:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSbbAAH.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132566iC28CBC3139B378A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSbbAAH.png" alt="0693p00000BDSbbAAH.png" /&gt;&lt;/span&gt;I will use a tXmlMap to get my status from the web service response and if it’s “completed_ok”(the status that I want to get) I will set the global variable “StatusAssistant” to “1” and the loop will stop otherwise it will continue to run.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSgCAAX.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134747iCC2A3704C2A0AC2C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSgCAAX.png" alt="0693p00000BDSgCAAX.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000BDSN5AAP.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155894i62CA9C3732DB306A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000BDSN5AAP.png" alt="0693p00000BDSN5AAP.png" /&gt;&lt;/span&gt;Have fun !&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2021 13:02:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318938#M89234</guid>
      <dc:creator>GerJea</dc:creator>
      <dc:date>2021-01-17T13:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over Web Service</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318939#M89235</link>
      <description>&lt;P&gt;You don't need the "Declaration" or the "Iteration" values. What you want is a variable in the "Condition" that is a Boolean that evaluates to&amp;nbsp;&lt;/P&gt;&lt;P&gt;true&amp;nbsp;and is set to&amp;nbsp;false&amp;nbsp;when you are wanting to end the loop.&lt;/P&gt;&lt;P&gt;In this case you should create a context ( for ex. FLAG) and change it's type to Boolean and make it false by Default.&lt;/P&gt;&lt;P&gt;Now we need to change the FLAG value when you get the "Correct" status.&lt;/P&gt;&lt;P&gt;So, you can use below java code in tJavaFlex to change the Flag value.&lt;/P&gt;&lt;P&gt;if (status == "Completed")&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;context.flag = true;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;No need of else condition, Let me know if this works or not.&lt;/P&gt;&lt;P&gt;You can also tell me the variables name so i can make a clear java code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reference link : https://stackoverflow.com/questions/25041657/how-to-end-tloop-when-desired-criteria-reached#:~:text=put(%22loop%22%2Ctrue,%22Condition%22%20in%20the%20tLoop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2021 13:11:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318939#M89235</guid>
      <dc:creator>Prakhar1</dc:creator>
      <dc:date>2021-01-17T13:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over Web Service</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318940#M89236</link>
      <description>&lt;P&gt;I tried with a flag and it works also ! Thanks you for your answer, it was super clear !&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2021 13:17:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318940#M89236</guid>
      <dc:creator>GerJea</dc:creator>
      <dc:date>2021-01-17T13:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over Web Service</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318941#M89237</link>
      <description>&lt;P&gt;Glad it also worked and thankyou for explaining your way also.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 06:25:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Loop-over-Web-Service/m-p/2318941#M89237</guid>
      <dc:creator>Prakhar1</dc:creator>
      <dc:date>2021-01-18T06:25:42Z</dc:date>
    </item>
  </channel>
</rss>

