<?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>foreach incrementation</title><link>https://community.appian.com/discussions/f/general/25250/foreach-incrementation</link><description>{a!localVariables( local!item:0, a!forEach( items: enumerate(2), expression: a!columnsLayout( columns: a!localVariables( local!outerIndex: fv!item, local!item:1, a!forEach( items: 1+enumerate(3), expression: a!columnLayout( contents: a!cardLayout( style</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98132?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 16:22:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4c7fa730-aefd-43ea-876a-b77d865215e1</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I agree, getting used to the way local variables works in Appian (including scoping) takes some getting used to, as it doesn&amp;#39;t behave the same way as it typically works in other programming languages, in a few important aspects.&amp;nbsp; But when you get used to how it DOES work, especially when you understand what i call &amp;quot;update chaining&amp;quot;, it gets REALLY powerful.&amp;nbsp; Generally I suggest starting with smaller, simpler examples and gradually stepping up the complexity when you really understand what you currently have.&lt;/p&gt;
&lt;p&gt;BTW if you found my above code snippet useful, I would appreciate a &amp;quot;verify answer&amp;quot; and/or upvote when convenient for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98126?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 14:50:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d00a13cd-fdca-4fb2-a12f-9a582d27c9d6</guid><dc:creator>nandhinip</dc:creator><description>&lt;p&gt;Thanks for your response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98125?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 14:50:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3548d897-0ef3-4a51-91cd-73b7368566c9</guid><dc:creator>nandhinip</dc:creator><description>&lt;p&gt;yes, As a beginner,has confusions to understand the behaviour of local variables and the scope. Thanks for the clear response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98123?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 14:28:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c54e0cae-12a2-43b9-a1bd-ed48f72aa1a1</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;You&amp;#39;re doing a lot of repeated / hardcoded calculations on things like column positioning, causing the code to get too complicated to read pretty quickly as we can see here.&amp;nbsp; Meanwhile you&amp;#39;re not properly calculating the proper column position for each data cell in a programmatic way, which is tripping up what you&amp;#39;re trying to do.&lt;/p&gt;
&lt;p&gt;The suggestion I always make with this is to let your local variables do some of the heavy lifting, then simply iterate.&amp;nbsp; First, we set a local variable to the number of total columns (to prevent it from being hardcoded everywhere and thus incomprehensible).&amp;nbsp; Then we step over the original data array and create a new array containing the initial data plus a new element indicating its column position, using the MOD() operator over the item&amp;#39;s index and the number of columns.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658326621089v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;This forms a secondary local variable array matching the first one, but with elements like this:&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658326757501v4.png" /&gt;&lt;/p&gt;
&lt;p&gt;Then instead of doing so much stressful redundant calculation inside the columns / cards, we can just rely on the column number stored in the current local variable position.&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658326859449v6.png" /&gt;&lt;/p&gt;
&lt;p&gt;And then when it&amp;#39;s time to print out the actual values, we can get rid of some of the mess:&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658326921256v7.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In this way you can have a dynamic display of tiles in columns, whether it&amp;#39;s 2 columns,&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658327309049v12.png" /&gt;&lt;br /&gt;...or 3 columns,&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658327157821v9.png" /&gt;&lt;br /&gt;...or 7 columns...&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658327300030v11.png" /&gt;... and so-on.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!selectedColumn:0,
  local!createdcard:0,
  local!datas: {
    {Name: &amp;quot;Name1&amp;quot;, Description: &amp;quot;Description1&amp;quot;},
    {Name: &amp;quot;Name2&amp;quot;, Description: &amp;quot;Description2&amp;quot;},
    {Name: &amp;quot;Name3&amp;quot;, Description: &amp;quot;Description3&amp;quot;},
    {Name: &amp;quot;Name4&amp;quot;, Description: &amp;quot;Description4&amp;quot;},
    {Name: &amp;quot;Name5&amp;quot;, Description: &amp;quot;Description5&amp;quot;},
    {Name: &amp;quot;Name6&amp;quot;, Description: &amp;quot;Description6&amp;quot;},
    {Name: &amp;quot;Name7&amp;quot;, Description: &amp;quot;Description7&amp;quot;},
    {Name: &amp;quot;Name8&amp;quot;, Description: &amp;quot;Description8&amp;quot;},
    {Name: &amp;quot;Name9&amp;quot;, Description: &amp;quot;Description9&amp;quot;},
    {Name: &amp;quot;Name10&amp;quot;, Description: &amp;quot;Description10&amp;quot;},
    {Name: &amp;quot;Name11&amp;quot;, Description: &amp;quot;Description11&amp;quot;},
    {Name: &amp;quot;Name12&amp;quot;, Description: &amp;quot;Description12&amp;quot;},
    {Name: &amp;quot;Name13&amp;quot;, Description: &amp;quot;Description13&amp;quot;},
    {Name: &amp;quot;Name14&amp;quot;, Description: &amp;quot;Description14&amp;quot;},
    {Name: &amp;quot;Name15&amp;quot;, Description: &amp;quot;Description15&amp;quot;},
  },
  local!selectedCard,
  
  
  local!numColumns: 4,
  
  local!columnPositions: a!forEach(
    local!datas,
    a!localVariables(
      local!modulo: mod(fv!index, local!numColumns),
      a!map(
        data: fv!item,
        column: if(local!modulo = 0, local!numColumns, local!modulo)
      )
    )
  ),
  
  {
    a!richTextDisplayField(
      labelPosition: &amp;quot;COLLAPSED&amp;quot;,
      value: {
        a!richTextItem(
          text: &amp;quot;Data&amp;quot;,
          color: &amp;quot;#b366ff&amp;quot;,
          size: &amp;quot;LARGE&amp;quot;
        ),
      },
      showWhen: isNull(local!selectedCard),
      align: &amp;quot;CENTER&amp;quot;
    ),  

    {
      a!columnsLayout(
        marginBelow: &amp;quot;NONE&amp;quot;,
        spacing: &amp;quot;SPARSE&amp;quot;,
        columns: {
          a!forEach(
            items: 1 + enumerate(local!numColumns),
            expression: {
              a!localVariables(
                local!columnIndex: fv!index,
                
                a!columnLayout(
                  contents: {
                    a!forEach(
                      /*items: 1+enumerate(count(local!datas.Name)),*/
                      items: local!columnPositions,
                      expression: if(
                        fv!item.column &amp;lt;&amp;gt; local!columnIndex,
                        {},
                        
                        {
                          a!cardLayout(
                            style: &amp;quot;INFO&amp;quot;,
                            marginBelow: &amp;quot;STANDARD&amp;quot;,
                            contents: {                                    
                              a!richTextDisplayField(
                                labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                                value: {
                                  char(10),
                                  char(10),
                                  a!richTextItem(
                                    /*text:if(((fv!index+(local!columnIndex-1)*2)&amp;gt;count(local!datas.Name)),&amp;quot; &amp;quot;,local!datas[fv!index+(local!columnIndex-1)*2].Name),*/
                                    text: fv!item.data.Name,
                                    color: &amp;quot;#1a1a00&amp;quot;,
                                    size: &amp;quot;MEDIUM&amp;quot;
                                  ),
                                  char(10),
                                  char(10),
                                  a!richTextItem(
                                    /*text: if(((fv!index+(local!columnIndex-1)*2)&amp;gt;count(local!datas.Name)),&amp;quot; &amp;quot;,local!datas[fv!index+(local!columnIndex-1)*2].Description),*/
                                    text: fv!item.data.Description,
                                    color: &amp;quot;#1a1a00&amp;quot;,
                                    size: &amp;quot;SMALL&amp;quot;,
                                    style: &amp;quot;PLAIN&amp;quot;
                                  ),
                                  char(10),

                                  a!richTextItem(
                                    text: &amp;quot; &amp;quot;,
                                    color: &amp;quot;#1a1a00&amp;quot;,
                                    size: &amp;quot;SMALL&amp;quot;,
                                    style: &amp;quot;PLAIN&amp;quot;
                                  )

                                },
                                align: &amp;quot;LEFT&amp;quot;

                              ),
                              a!richTextDisplayField(
                                labelPosition: &amp;quot;COLLAPSED&amp;quot;,                      
                                value: a!richTextItem(                        
                                  text: {
                                    a!richTextIcon(
                                      icon: &amp;quot;external-link&amp;quot;,
                                      altText: &amp;quot;external-link&amp;quot;
                                    ),
                                    &amp;quot; &amp;quot;,
                                    &amp;quot;viewmore &amp;quot;,
                                    fv!index
                                    /*&amp;amp;(fv!index+(local!columnIndex-1)*2),*/
                                  },

                                  link: a!dynamicLink(
                                    saveInto: {
                                      /*a!save(local!selectedCard, if(((fv!index+(local!columnIndex-1)*2)&amp;gt;count(local!datas.Name)),&amp;quot; &amp;quot;,local!datas[fv!index+(local!columnIndex-1)*2].Name)),*/
                                      a!save(local!selectedCard, fv!index),
                                      /*a!save(local!selectedColumn, 1),*/
                                      a!save(
                                        local!createdcard,
                                        /*(fv!index+(local!columnIndex-1)*2)*/
                                        fv!item.data
                                      )
                                    }
                                  ),
                                  linkStyle: &amp;quot;STANDALONE&amp;quot;,
                                  color:&amp;quot;#a64dff&amp;quot;
                                ),
                                align: &amp;quot;CENTER&amp;quot;,
                              ) 
                            },
                            height: &amp;quot;SHORT_PLUS&amp;quot;,
                            shape: &amp;quot;ROUNDED&amp;quot;,
                            /*showWhen: tointeger((fv!index+(local!columnIndex-1)*2))&amp;lt;=count(local!datas.Name),*/
                          ),
                          /*a!cardLayout(showBorder: false), */
                        }
                      )

                    ) 
                  },                          
                  width: &amp;quot;MEDIUM_PLUS&amp;quot;
                )
              )
              /*a!columnLayout()*/
            }
          )
        },
        
        /*showWhen: isNull(local!selectedCard),*/
        showWhen: tointeger(local!selectedColumn = 0)
      )
    }
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98111?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 11:31:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:223d5123-a341-44ed-86ce-e559631d84a4</guid><dc:creator>rahata9316</dc:creator><description>&lt;p&gt;Thanks Stefan, for always a great guide. Actually this code was from Nandinip and most logic was about logic ( Use case was based on two integers Let say 2 &amp;amp; 3) Need to draw dynamic texboxes&amp;nbsp; in sequence with in a way that it should be of 3 columns and 2 rows.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658316658881v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98104?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 10:25:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d64cd0e9-f555-4916-9a35-223fd07cb9dd</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Which purpose has the local!item in line 2? And why do you store fv!item inside the outer loop into two different locals?&lt;/p&gt;
&lt;p&gt;Regarding variables in Appian Interfaces I recommend my blog article:&amp;nbsp;&lt;a href="https://appian.rocks/2022/07/05/data-in-interfaces/"&gt;appian.rocks/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next time, please use this function:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658312534243v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98093?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 09:34:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:90a389a2-0ea5-4429-b2e3-580e80e9df1a</guid><dc:creator>rahata9316</dc:creator><description>&lt;p&gt;Hi Nandhinip,&lt;/p&gt;
&lt;p&gt;I hope this will sort your problem. Hope you will get desired results now.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a!localVariables(&lt;br /&gt; local!item:0,&lt;br /&gt; local!outerEnum: 3,&lt;br /&gt; local!innerEnum: 8,&lt;br /&gt; a!forEach(&lt;br /&gt; items: enumerate( local!outerEnum),&lt;br /&gt; expression: a!columnsLayout(&lt;br /&gt; columns: a!localVariables(&lt;br /&gt; local!outerIndex: fv!item,&lt;br /&gt; local!item:fv!item,&lt;br /&gt; a!forEach(&lt;br /&gt; items: enumerate(local!innerEnum),&lt;br /&gt; expression: a!columnLayout(&lt;br /&gt; contents: a!cardLayout(&lt;br /&gt; style: &amp;quot;INFO&amp;quot;,&lt;br /&gt; contents: {&lt;br /&gt; a!textField(&lt;br /&gt; &lt;br /&gt; value: ((local!innerEnum * local!item) + fv!index),&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; ),&lt;br /&gt; a!richTextDisplayField(&lt;br /&gt; labelPosition: &amp;quot;COLLAPSED&amp;quot;,&lt;br /&gt; align: &amp;quot;CENTER&amp;quot;,&lt;br /&gt; value: a!richTextItem(&lt;br /&gt; text:local!item,&lt;br /&gt; color: &amp;quot;#1a1a00&amp;quot;,&lt;br /&gt; size: &amp;quot;MEDIUM&amp;quot;,&lt;br /&gt; ),&lt;br /&gt; ),&lt;br /&gt; },&lt;br /&gt; height: &amp;quot;MEDIUM&amp;quot;,&lt;br /&gt; shape: &amp;quot;ROUNDED&amp;quot;,&lt;br /&gt; ),&lt;/p&gt;
&lt;p&gt;)&lt;br /&gt; )&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><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98089?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 07:51:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b574d255-c45b-4b5d-bc6d-349aa37f1934</guid><dc:creator>nandhinip</dc:creator><description>&lt;p&gt;for enumerate(3),&lt;span&gt;getting the below output&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658303494410v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;if i increase the enumeration to 10 .i.e enumerate(10),getting the below output&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658303418356v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98088?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 07:44:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a05f1d75-5365-4759-8101-c10d108d3608</guid><dc:creator>rahata9316</dc:creator><description>&lt;p&gt;Can you please try below code&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a!localVariables(&lt;br /&gt; local!item:0,&lt;br /&gt; a!forEach(&lt;br /&gt; items: enumerate(2),&lt;br /&gt; expression: a!columnsLayout(&lt;br /&gt; columns: a!localVariables(&lt;br /&gt; local!outerIndex: fv!item,&lt;br /&gt; local!item:fv!index,&lt;br /&gt; a!forEach(&lt;br /&gt; items: enumerate(3),&lt;br /&gt; expression: a!columnLayout(&lt;br /&gt; contents: a!cardLayout(&lt;br /&gt; style: &amp;quot;INFO&amp;quot;,&lt;br /&gt; contents: {&lt;br /&gt; a!textField(&lt;br /&gt; &lt;br /&gt; value: (((local!item + fv!index) - 1) + ((local!item - 1) * 2) )&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; ),&lt;br /&gt; a!richTextDisplayField(&lt;br /&gt; labelPosition: &amp;quot;COLLAPSED&amp;quot;,&lt;br /&gt; align: &amp;quot;CENTER&amp;quot;,&lt;br /&gt; value: a!richTextItem(&lt;br /&gt; text:local!item,&lt;br /&gt; color: &amp;quot;#1a1a00&amp;quot;,&lt;br /&gt; size: &amp;quot;MEDIUM&amp;quot;,&lt;br /&gt; ),&lt;br /&gt; ),&lt;br /&gt; },&lt;br /&gt; height: &amp;quot;MEDIUM&amp;quot;,&lt;br /&gt; shape: &amp;quot;ROUNDED&amp;quot;,&lt;br /&gt; ),&lt;/p&gt;
&lt;p&gt;)&lt;br /&gt; )&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><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98058?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 04:24:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12d7231b-519e-4d5d-a933-3185895346f4</guid><dc:creator>nandhinip</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; a!localVariables(
   local!selectedColumn:0,
   local!createdcard:0,   
   local!datas: {
     {Name:&amp;quot;Name1&amp;quot;,Description:&amp;quot;Description1&amp;quot;},
     {Name:&amp;quot;Name2&amp;quot;,Description:&amp;quot;Description2&amp;quot;},
     {Name:&amp;quot;Name3&amp;quot;,Description:&amp;quot;Description3&amp;quot;},                          
     {Name:&amp;quot;Name4&amp;quot;,Description:&amp;quot;Description4&amp;quot;},                          
     {piName:&amp;quot;Name5&amp;quot;,Description:&amp;quot;Description5&amp;quot;},
     {Name:&amp;quot;Name6&amp;quot;,Description:&amp;quot;Description6&amp;quot;},
     {Name:&amp;quot;Name7&amp;quot;,Description:&amp;quot;Description7&amp;quot;},
     {Name:&amp;quot;Name8&amp;quot;,Description:&amp;quot;Description8&amp;quot;},                          
     {Name:&amp;quot;Name9&amp;quot;,Description:&amp;quot;Description9&amp;quot;},                          
     {Name:&amp;quot;Name10&amp;quot;,Description:&amp;quot;Description10&amp;quot;},  
     {Name:&amp;quot;Name11&amp;quot;,Description:&amp;quot;Description11&amp;quot;},
     {Name:&amp;quot;Name12&amp;quot;,Description:&amp;quot;Description12&amp;quot;},
     {Name:&amp;quot;Name13&amp;quot;,Description:&amp;quot;Description13&amp;quot;},                          
     {Name:&amp;quot;Name14&amp;quot;,Description:&amp;quot;Description14&amp;quot;},                          
     {Name:&amp;quot;Name15&amp;quot;,Description:&amp;quot;Description15&amp;quot;},  
   },
 local!selectedCard,
 {
   a!richTextDisplayField(

     labelPosition: &amp;quot;COLLAPSED&amp;quot;,
     value: {
       char(10),         
       a!richTextItem(
         text: &amp;quot;Datas&amp;quot;,
         color: &amp;quot;#b366ff&amp;quot;,
         size: &amp;quot;LARGE&amp;quot;
       ),
       char(10)
     },

     showWhen: isNull(local!selectedCard),
     align: &amp;quot;CENTER&amp;quot;
   ),  
 
 {
   a!columnsLayout(
     marginBelow: &amp;quot;NONE&amp;quot;,
     spacing: &amp;quot;NONE&amp;quot;,
     columns: {
       a!columnLayout(),
       a!forEach(
         items: 1+enumerate(2),                        
         expression: {
           a!localVariables(
             local!outerIndex:fv!index,
             a!columnLayout(
               contents: {
                 a!forEach(
                   items:1+enumerate(count(local!datas.Name)),
                   expression: {
                     a!localVariables(
                       local!innerIndex:fv!index,
                       a!cardLayout(
                         style: &amp;quot;INFO&amp;quot;,                             
                         contents: {                                    
                           a!richTextDisplayField(
                             labelPosition: &amp;quot;COLLAPSED&amp;quot;,
                             value: {
                               char(10),
                               char(10),
                               a!richTextItem(
                                 text:if(((fv!index+(local!outerIndex-1)*2)&amp;gt;count(local!datas.Name)),&amp;quot; &amp;quot;,local!datas[fv!index+(local!outerIndex-1)*2].Name),
                                 color: &amp;quot;#1a1a00&amp;quot;,
                                 size: &amp;quot;MEDIUM&amp;quot;
                               ),
                               char(10),
                               char(10),
                               a!richTextItem(
                                 text: if(((fv!index+(local!outerIndex-1)*2)&amp;gt;count(local!datas.Name)),&amp;quot; &amp;quot;,local!datas[fv!index+(local!outerIndex-1)*2].Description),
                                 color: &amp;quot;#1a1a00&amp;quot;,
                                 size: &amp;quot;SMALL&amp;quot;,
                                 style: &amp;quot;PLAIN&amp;quot;
                               ),
                               char(10),
                               
                               a!richTextItem(
                                 text: &amp;quot; &amp;quot;,
                                 color: &amp;quot;#1a1a00&amp;quot;,
                                 size: &amp;quot;SMALL&amp;quot;,
                                 style: &amp;quot;PLAIN&amp;quot;
                               )

                             },
                             align: &amp;quot;LEFT&amp;quot;

                           ),
                           a!richTextDisplayField(
                             labelPosition: &amp;quot;COLLAPSED&amp;quot;,                      
                             value: a!richTextItem(                        
                               text: {
                                 a!richTextIcon(
                                   icon: &amp;quot;external-link&amp;quot;,
                                   altText: &amp;quot;external-link&amp;quot;

                                 ),
                                 &amp;quot; &amp;quot;,
                                 &amp;quot;viewmore&amp;quot; &amp;amp;&amp;quot; &amp;quot;&amp;amp;(fv!index+(local!outerIndex-1)*2),

                               },

                               link: a!dynamicLink(
                                 saveInto: {
                                   a!save(local!selectedCard, if(((fv!index+(local!outerIndex-1)*2)&amp;gt;count(local!datas.Name)),&amp;quot; &amp;quot;,local!datas[fv!index+(local!outerIndex-1)*2].Name)),
                                   a!save(local!selectedColumn,1),
                                   a!save(local!createdcard,(fv!index+(local!outerIndex-1)*2)),
                                   

                                 }
                               ),
                               linkStyle: &amp;quot;STANDALONE&amp;quot;,
                               color:&amp;quot;#a64dff&amp;quot;
                             ),
                             align: &amp;quot;CENTER&amp;quot;,
                           ) 
                         },
                         height: &amp;quot;MEDIUM&amp;quot;,
                         shape:&amp;quot;ROUNDED&amp;quot;,
                         showWhen: tointeger((fv!index+(local!outerIndex-1)*2))&amp;lt;=count(local!datas.Name),
                       )
                       

                     ) ,
                     a!cardLayout(showBorder: false), 
                     
                   },

                 ) 
               },                          

               width: &amp;quot;MEDIUM_PLUS&amp;quot;
             )
           ),a!columnLayout()
         }
        
       ),
      
     },                  
     /*showWhen: isNull(local!selectedCard),                  */
     showWhen: tointeger(local!selectedColumn=0)

   ),
 }
 }
 
 )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is code i have tried&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98057?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 04:04:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0804fb80-232c-42ac-8e4b-c1a4d13843b2</guid><dc:creator>nandhinip</dc:creator><description>&lt;p&gt;i have 2 columns and number of rows depends on dynamic data.&lt;/p&gt;
&lt;p&gt;if i have 20 values means first 10 value in column1 and next 10 value in column2.&lt;/p&gt;
&lt;p&gt;e.g&lt;/p&gt;
&lt;p&gt;outerforeach:enumerate(2)&lt;/p&gt;
&lt;p&gt;innerforeach:enumerate(20)&lt;/p&gt;
&lt;p&gt;i have used&amp;nbsp; &amp;nbsp;(fv!index+(local!outerIndex-1)*2) ----this logic to print the number from 1 to 20 in the given column layout as suggested earlier in this forum..&lt;/p&gt;
&lt;p&gt;but it is printing 1 to 10 in 1st column layout, and 3 to 12 in another column layout.&lt;/p&gt;
&lt;p&gt;it is not in sequence. unable to increment the fv!index as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98056?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2022 03:56:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0e3024a3-524f-46af-90b2-63d7c25199da</guid><dc:creator>nandhinip</dc:creator><description>&lt;p&gt;if the number of row increases , the one which was discussed earlier was not working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98048?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 18:54:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e7d0155f-bc4f-465b-8335-de99faf56923</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I&amp;#39;m not really clear what you&amp;#39;re trying to do here overall, but you seem to be misunderstanding how local variables work and how saveInto works.&amp;nbsp; For instance, the local!item: 0 you declare on line 2 is irrelevant to this code snippet as it&amp;#39;s never used, since you supersede it in scope by re-declaring local!item inside your forEach loop, on line 8.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Additionally, local!outerIndex is never used either.&amp;nbsp; And the saveInto you&amp;#39;re doing in your text field (whether this is your intended behavior or not, i honestly can&amp;#39;t tell), just adds 1 to the current grid row&amp;#39;s local!item value, regardless of what the user inputs (and has no effect whatsoever prior to the user interacting with the text field).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98043?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 18:44:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30e8b0b4-7f14-4894-b147-f68f5388cc79</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Please use a Code Box, which preserves indentation/formatting and improves readability of code (back up out of the negatives)...&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1658256121099v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: foreach incrementation</title><link>https://community.appian.com/thread/98042?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2022 18:43:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bcdb8bbc-bdd2-4ed7-8aa6-4104eba01391</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Isn&amp;#39;t it somewhat the same post - &lt;a href="https://community.appian.com/discussions/f/general/25147/nested-for-each?"&gt;community.appian.com/.../nested-for-each&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>