<?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>Adding rows at specified position in a grid</title><link>https://community.appian.com/discussions/f/user-interface/24770/adding-rows-at-specified-position-in-a-grid</link><description>Hi, 
 I need to add a grid row right after I cloned(click on a link) the first one. I have used insert function for that. 
 But still, the row is adding before the main row i.e at the starting of the grid rows 
 Co Could anyone please help me on the above</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95812?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 13:44:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:73154578-4ae4-4a48-95c6-37dfa8b8131b</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;This is probably because you do not manage the variable ri!index correctly. You might have to update ri!index with the row you click before inserting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95811?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 13:39:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:633cb7e7-13f3-46a9-8a4a-3170523f071d</guid><dc:creator>Anupriya Sathyamoorthy</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The issue seems to be at the index parameter on the Insert function. You have given as&amp;nbsp;(wherecontains(ri!data[ri!index],ri!data)), which will return the current index (i.e. the row from which you click clone icon).&lt;/p&gt;
&lt;p&gt;For example, if you clicking on Clone in first row, &lt;strong&gt;(wherecontains(ri!data[ri!index],ri!data))&amp;nbsp;&lt;/strong&gt;expression will return 1 as index in Insert, so the row is adding at first instead of 2nd row.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t understand how you evaluated that after saving and come back to the screen, shows correct index, because after cloning, the first and second row looks identical.&lt;/p&gt;
&lt;p&gt;Can you please explain how you are saying that saving and come back to the screen, show correct index?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95802?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 12:09:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:308dd4bf-2451-441d-8a67-51387220099e</guid><dc:creator>akhilag7167</dc:creator><description>&lt;p&gt;Hi AnuPriya,&lt;/p&gt;
&lt;p&gt;It is working fine with the above code. But I&amp;#39;m facing a problem. When I clone a row, it is adding at index 1 initially. But when I save and come back to the screen again, it is appearing a correct index. Don&amp;#39;t know why this behaviour is happening.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95781?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 07:08:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ec6cd9f3-d962-4e18-a021-b2011b6c4187</guid><dc:creator>Anupriya Sathyamoorthy</dc:creator><description>&lt;p&gt;Hi &lt;a href="/members/akhilag7167"&gt;akhilag7167&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Can you please try with the &amp;quot;ri!index+1&amp;quot;&amp;nbsp;for the index parameter in the Insert function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It seems the index value you have given in the Insert function is to add the value at the same row. Please refer the below code&lt;pre class="ui-code" data-mode="text"&gt;a!richTextItem(
          text: a!richTextIcon(icon: &amp;quot;Add&amp;quot;, caption: &amp;quot;Create Rows&amp;quot;),
          link: a!dynamicLink(
            value: ri!data[ri!index],
            saveInto: {
              a!save(
                ri!data,
                insert(
                  ri!data,
                  &amp;#39;type!{urn:com:appian:types}C_CDTName&amp;#39;(
                    Id: ri!data[ri!index].Id,
                    HeaderLine: ri!data[ri!index].HeaderLine,
                    Desc: ri!data[ri!index].Desc,
                  ),ri!index+1,
                )
              ),
          ),
          linkStyle:&amp;quot;STANDALONE&amp;quot;
        ),&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95780?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 07:02:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bff10c3f-e98d-42ba-a351-8b94d05e9330</guid><dc:creator>akhilag7167</dc:creator><description>&lt;p&gt;I tried with ri!index. Also printing the ri!index value and it has the expected index. But still when I clone, new row is adding at the starting position i.e at index 1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95777?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 06:54:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e8f73ac5-60b0-4710-ba9e-602b60f7d7dd</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;The insert function takes an index for where to add the item. Your definition of that index seems weird. Did you try just ri!index? And does ri!index contain the expected value?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95771?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 06:33:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ed2d0db-67df-46fe-803f-7841b1422295</guid><dc:creator>akhilag7167</dc:creator><description>&lt;p&gt;Hi Gopal,&lt;/p&gt;
&lt;p&gt;In a grid row layout, I have provided an icon at the end of each grid row. Once I click on that icon, new row with the data should get appended to the layout. For example if we have 5 rows and we cloned the first row, the new row should get added in the second position. But right now with the above code, it is getting added in the first position.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding rows at specified position in a grid</title><link>https://community.appian.com/thread/95769?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 06:20:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f87a64df-df78-4575-aa04-fd186274a50b</guid><dc:creator>GopalK</dc:creator><description>&lt;p&gt;HI Akhil, Could not understand your requirement exactly. could you please explain little bit more?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>