<?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>Need help comparing current index item to previous index item in a foreach loop</title><link>https://community.appian.com/discussions/f/general/25343/need-help-comparing-current-index-item-to-previous-index-item-in-a-foreach-loop</link><description>Hello All, 
 I&amp;#39;m currently creating an editable grid for school records with a field called year graduated. I want the following entries for this field to be compared with previous row to check if the year is greater than the previous row and output an</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Need help comparing current index item to previous index item in a foreach loop</title><link>https://community.appian.com/thread/98586?ContentTypeID=1</link><pubDate>Thu, 28 Jul 2022 04:51:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f20eb047-71e2-4d2a-9112-a43333809842</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;That is correct. But please remember to add the 3rd parameter in the function (default value) so that the function does not break when the index is not available. Also, please add a check so this condition does not run for the first item in the list.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need help comparing current index item to previous index item in a foreach loop</title><link>https://community.appian.com/thread/98583?ContentTypeID=1</link><pubDate>Thu, 28 Jul 2022 03:28:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:47350455-7d2a-4b28-a604-dd77988d225c</guid><dc:creator>anwillec</dc:creator><description>&lt;p&gt;I was able to solve it. I used the rule input instead since I append the rows to rule input each time I add one.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;index(ri!educationalBackground.yearGraduated, fv!index - 1)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>