<?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>subtract</title><link>https://community.appian.com/discussions/f/general/17124/subtract</link><description>Hello everyone, 
 
 I have a problem with this: 
 
 I have for example 4 registers, and I just want one(local!contador), and inside of foreach, I have some conditions. 
 Well, I dont know how decrement local!contador for my condition in AND, i.e., if</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: subtract</title><link>https://community.appian.com/thread/67517?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:40:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:657b411e-13fe-4c7c-b566-eebc1039bda0</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;No prob -&amp;nbsp;glad to help ;-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtract</title><link>https://community.appian.com/thread/67515?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:36:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7c3c512f-b722-42d5-a7f0-9c5b0749393a</guid><dc:creator>mteresa</dc:creator><description>&lt;p&gt;Use enumerate give me one idea, and its works:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1560962145846v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In the end of the rule, i applied this and works. Thank you so much Mike&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtract</title><link>https://community.appian.com/thread/67514?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:34:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ffd3149d-23fd-4fef-8322-16cbaec37fe4</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What is the value you&amp;#39;re passing in for ri!register?&amp;nbsp; Your code as written should be doing one loop for each item in that.&amp;nbsp; So if you only pass in 1, it will only do the forEach loop once.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtract</title><link>https://community.appian.com/thread/67513?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:32:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4907a1bf-38f2-4767-a637-13e261375836</guid><dc:creator>mteresa</dc:creator><description>&lt;p&gt;Thank you, but doesnt work,just give me One register, i think because just do the loop one time&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtract</title><link>https://community.appian.com/thread/67512?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:22:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:eb0d92cd-c0d2-4770-b508-98757d7ad44b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;If I assume correctly that local!contador will be the number of entries you want to return, this is still pretty easy to do:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;index(
  local!results,
  enumerate(local!contador)+1, /* if contador=3, this will return array like {1,2,3} */
  null()
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtract</title><link>https://community.appian.com/thread/67511?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:20:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ea99bfa-27e8-43b0-bec3-5042c61424ba</guid><dc:creator>mteresa</dc:creator><description>&lt;p&gt;Hello, thank you for answer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried index but doesnt work for me, becuase the number of registers I need change, can be 1, 2, 3... not is always 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: subtract</title><link>https://community.appian.com/thread/67510?ContentTypeID=1</link><pubDate>Wed, 19 Jun 2019 16:11:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:082efd5f-fe20-4b3b-834f-fdca6dc311d6</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;You can&amp;#39;t decrement external values from within a loop of a!forEach.&lt;/p&gt;
&lt;p&gt;If I understand correctly what you&amp;#39;re trying to do, I would just store the results of your a!forEach loop in a local variable (for example) and then get the first index (to get the result in the first position of the array), e.g. &amp;quot;&lt;strong&gt;local!results[1]&lt;/strong&gt;&amp;quot;, or &amp;quot;&lt;strong&gt;index(local!results, 1, {})&lt;/strong&gt;&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>