<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Stop the loop if a value is found</title><link>https://community.appian.com/discussions/f/general/37771/stop-the-loop-if-a-value-is-found</link><description>For a list of integers, I need to check the desired value by calling a service. I would like to stop calling the service, only I get the desired output. Any suggestions, please.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Stop the loop if a value is found</title><link>https://community.appian.com/thread/141975?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 14:03:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:05eebb45-54e3-4ffe-b70b-df7933f770ba</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;thanks for confirming!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop the loop if a value is found</title><link>https://community.appian.com/thread/141946?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 07:02:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ba5adcaf-3f76-4411-b210-a9b27f76eae1</guid><dc:creator>Sharmila Nagaraj</dc:creator><description>&lt;p&gt;Thanks &lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&amp;nbsp;for your suggestion. It worked.&lt;/p&gt;
&lt;p&gt;&lt;a href="/members/stefanhelzle0001"&gt;Stefan Helzle&lt;/a&gt;&amp;nbsp;&lt;a href="/members/somasundaram.d"&gt;Soma&lt;/a&gt;&amp;nbsp; thanks for your time.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop the loop if a value is found</title><link>https://community.appian.com/thread/141913?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 13:59:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:75ffe720-1e0e-4420-941d-a2c8fa401922</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;This could potentially be one of the few times that it&amp;#39;s helpful to call an expression rule recursively.&lt;/p&gt;
&lt;p&gt;Pattern: rule!RULE_myFunction(list of integers)&lt;/p&gt;
&lt;p&gt;if(&lt;br /&gt;&amp;nbsp; (list index 1 meets condition),&lt;br /&gt;&amp;nbsp; [Return Value],&lt;br /&gt;&amp;nbsp; rule!RULE_myFunction(ldrop(list of integers, 1))&amp;nbsp; /* pass in the same array, but with the first element removed */&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop the loop if a value is found</title><link>https://community.appian.com/thread/141911?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 13:27:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:58a4d561-f52a-42ae-ba07-c6cc36344291</guid><dc:creator>Soma</dc:creator><description>&lt;p&gt;There is no break concept in Appian.&lt;/p&gt;
&lt;p&gt;But using reduce, call the service for list of integers. For every iteration append the desired output to a list and check if the list contains your desired output. If the list contains the output just return null instead of calling the service.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop the loop if a value is found</title><link>https://community.appian.com/thread/141902?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 10:30:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8811f058-abe5-459b-8bc7-d56041bdae36</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;In Appian there is only a foreach(). And this cannot be interrupted.&lt;/p&gt;
&lt;p&gt;But using the reduce() function, while still iterating on all list items, you can decide whether to call your service based on previous results.&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://appian.rocks/2022/08/29/complex-algorithms-in-appian/"&gt;https://appian.rocks/2022/08/29/complex-algorithms-in-appian/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stop the loop if a value is found</title><link>https://community.appian.com/thread/141900?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 10:16:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fc7aa25-1a6b-49a6-b2e2-4b455804387f</guid><dc:creator>Sharmila Nagaraj</dc:creator><description>&lt;p&gt;This needs to be calculated in an expression rule on load.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>