<?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>How can i display a statement only once in a loop which is running 4 times?</title><link>https://community.appian.com/discussions/f/general/22152/how-can-i-display-a-statement-only-once-in-a-loop-which-is-running-4-times</link><description>Hi, 
 I have the following code where i want to display the message &amp;quot;Hello World&amp;quot; only once in a loop . what condition i should write? 
 
 a!localVariables( 
 a!forEach( items: {1,2,3,4}, expression: { concat(&amp;quot;Hello &amp;quot;,&amp;quot; World&amp;quot;) 
 } 
 ) )</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How can i display a statement only once in a loop which is running 4 times?</title><link>https://community.appian.com/thread/86780?ContentTypeID=1</link><pubDate>Fri, 08 Oct 2021 06:56:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c43cafd5-550d-4666-a364-94c55edee751</guid><dc:creator>ashutoshg0001</dc:creator><description>&lt;p&gt;Thanks it works&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i display a statement only once in a loop which is running 4 times?</title><link>https://community.appian.com/thread/86779?ContentTypeID=1</link><pubDate>Fri, 08 Oct 2021 06:56:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f6ed8de8-d2c4-4cc8-9048-ece8b530c9d2</guid><dc:creator>ashutoshg0001</dc:creator><description>&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i display a statement only once in a loop which is running 4 times?</title><link>https://community.appian.com/thread/86777?ContentTypeID=1</link><pubDate>Fri, 08 Oct 2021 06:16:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fa0fb3d-7911-4a2d-aa3a-87780309c6dc</guid><dc:creator>Acacio Barrado</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if I got your requirement, but if you just want the unique values after a loop, you can try something similar to that:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!a: a!forEach(
    items: { 1, 2, 3, 4 },
    expression: { concat(&amp;quot;Hello &amp;quot;, &amp;quot; World&amp;quot;) }
  ),
  union(local!a, local!a)
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Acacio B&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can i display a statement only once in a loop which is running 4 times?</title><link>https://community.appian.com/thread/86776?ContentTypeID=1</link><pubDate>Fri, 08 Oct 2021 06:15:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:17a9e1f1-b1fb-4076-969e-68308b289fea</guid><dc:creator>dastagirid756</dc:creator><description>&lt;p&gt;In order to display a message once in a loop, first decide the condition for displaying a message. Then implement the condition inside the loop.&lt;/p&gt;
&lt;p&gt;For example, if I want to display the Hello World when I reach second iteration or item, follow the below code snippet&lt;/p&gt;
&lt;p&gt;a!forEach(&lt;br /&gt; items: { 1, 2, 3, 4 },&lt;br /&gt; expression: {&lt;br /&gt; if(&lt;br /&gt; fv!item = 2,&lt;br /&gt; concat(&amp;quot;Hello &amp;quot;, &amp;quot; World&amp;quot;),&lt;br /&gt; null&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To avoid null values in the results:&lt;/p&gt;
&lt;p&gt;reject(&lt;br /&gt; fn!isnull,&lt;br /&gt; a!forEach(&lt;br /&gt; items: { 1, 2, 3, 4 },&lt;br /&gt; expression: {&lt;br /&gt; if(&lt;br /&gt; fv!item = 2,&lt;br /&gt; concat(&amp;quot;Hello &amp;quot;, &amp;quot; World&amp;quot;),&lt;br /&gt; null&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>