<?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>Indexing array in the grid</title><link>https://community.appian.com/discussions/f/rules/18985/indexing-array-in-the-grid</link><description>Hey Everyone , 
 I need to display the data in the grid as : 
 
 
 
 Type 
 Description 
 Country 
 
 
 Nameabc1 
 abc 
 
 Brasil , India 
 
 
 
 nameabc2 
 def 
 
 Nepal 
 
 
 
 
 My data looks like . 
 [Type=[id=1, name=nameabc1], country=[id=Bra, name</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74557?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 13:49:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9a705fb4-60b1-4cff-a4fe-7e0e957079b3</guid><dc:creator>kasiss0001</dc:creator><description>&lt;p&gt;Couldn&amp;#39;t thank you more .&amp;nbsp;&lt;br /&gt;THanks again though&amp;nbsp;&amp;nbsp;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt; . :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74552?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 12:11:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c34988fe-86ca-42d3-a1a9-c3234b22b474</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;As for showing all countries - I expect your problem is that you may have been trying to pass an array of countries back to the grid, which confuses the old grid rendering system as it can&amp;#39;t tell the difference between a single array and an array of arrays.&amp;nbsp; You already got a count of countries to work, so to show all countries we just need to go one step further and turn the *array* of countries into a *single string* of countries.&lt;/p&gt;
&lt;p&gt;Add this new column to the code you already have and see if it works at all.&amp;nbsp; Once again I&amp;#39;ve stripped out the seemingly unnecessary multiple layers of a!forEach calls.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!gridTextColumn(
  label: resource(&amp;quot;List of Country (test)&amp;quot;),
  data: a!forEach(
    items: local!datasubset,
    expression: joinarray(
      property(fv!item, &amp;quot;country&amp;quot;, {}),
      char(10) /* this will add a linebreak, but you can add whatever separator you want */
    )
  )
),&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74551?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 12:02:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a540d885-b8ab-448f-83e8-8a9f30dfff48</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;First, why does each column of your grid call a triple-nested stack of a!forEach calls?&amp;nbsp; That seems like it should be totally unnecessary.&amp;nbsp; For instance, I would think your &lt;strong&gt;&lt;em&gt;description&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt; column should just be able to use this code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!gridTextColumn(
  label: resource( &amp;quot;Description&amp;quot; ),
  field: &amp;quot;description&amp;quot;,
  data: a!forEach(
    items: local!dataSubset,
    expression: property(fv!item, &amp;quot;description&amp;quot;, {})
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74547?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2020 07:59:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:af2b6c30-85ff-42e5-8414-4fc618a8c81d</guid><dc:creator>kasiss0001</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; a!gridField(
        label: &amp;quot;Deal Collateral&amp;quot;,
        labelPosition: &amp;quot;COLLAPSED&amp;quot;,
        totalCount: local!datasubset.totalCount,
        emptyGridMessage: resource(
          &amp;quot;No Collateral available&amp;quot;
        ),
        columns : {
            a!gridTextColumn(
            label: resource(&amp;quot;Type&amp;quot;),
            field: &amp;quot;collateraltype&amp;quot;,
            data: a!forEach(
              items: local!datasubset,
              expression: a!forEach(
                items: fv!item.data,
                expression: a!forEach(
                  items: fv!item,
                  expression: index(
                    index(
                      fv!item,
                      &amp;quot;Type&amp;quot;,
                      null
                    ),
                    &amp;quot;name&amp;quot;,
                    null
                  )
                )
              )
            )
          ),
          a!gridTextColumn(
            label: resource(
              &amp;quot;Description&amp;quot;
            ),
            field: &amp;quot;description&amp;quot;,
            data: a!forEach(
              items: local!datasubset,
              expression: a!forEach(
                items: fv!item.data,
                expression: a!forEach(
                  items: fv!item,
                  expression: index(
                    fv!item,
                    &amp;quot;description&amp;quot;,
                    null
                  )
                )
              )
            )
          ),
          a!gridTextColumn(
            label: resource(
              &amp;quot;Count of Country(test)&amp;quot;
            ),
            field: &amp;quot;country&amp;quot;,
            data: a!forEach(
              items: local!datasubset,
              expression: a!forEach(
                items: fv!item.data,
                expression: a!forEach(
                  items: fv!item,
                  expression: a!forEach(
                    items: fv!item,
                    expression: count(
                      fv!item.country
                    )
                  )
                )
              )
            )
          ),
          a!gridTextColumn(
            label: resource(
              &amp;quot;Country&amp;quot;
            ),
            field: &amp;quot;country&amp;quot;,
            data: a!forEach(
              items: local!datasubset,
              expression: a!forEach(
                items: fv!item.data,
                expression: a!forEach(
                  items: fv!item,
                  expression: a!forEach(
                    items: fv!item,
                    expression: a!forEach(
                      items: fv!item.country[1],
                      expression: fv!item
                    )
                  )
                )
              )
            )
          )
        }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;gives me the table as below :&lt;/p&gt;
&lt;table height="41" width="389"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Type&lt;/td&gt;
&lt;td&gt;Description&lt;/td&gt;
&lt;td&gt;Count of country(test)&lt;/td&gt;
&lt;td&gt;Country&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nameabc1&lt;/td&gt;
&lt;td&gt;abc&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;Brasil&amp;nbsp;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nameabc2&lt;/td&gt;
&lt;td&gt;def&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;
&lt;p&gt;Nepal&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a!foreach(&lt;/p&gt;
&lt;p&gt;items: local!datasubset,&lt;/p&gt;
&lt;p&gt;expressions : local!datasubset .data&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;Returns:&amp;nbsp;&lt;span&gt;[Type=[id=1, name=nameabc1], country=[id=Bra, name=Brasil]; [id=Ind, name=India], description=abc];[Type=[id=2, name=nameabc2], country=[id=Nep, name=Nepal], description=Testing def]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am not able to show all the countries as it says the totalcount exceed the number of largest column data .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74543?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 22:30:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:539d664e-8e5f-4129-9cd2-936b6c69fb03</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Can you post the code you&amp;#39;re currently using for your grid?&amp;nbsp; Please use &amp;quot;Insert --&amp;gt; Insert Code&amp;quot; to generate a code box to maintain indentation and preserve readability.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74542?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 20:15:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6051005c-4df6-40d1-b72b-779283e598fe</guid><dc:creator>kasiss0001</dc:creator><description>&lt;p&gt;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;18.3&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74541?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 20:08:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e1cb808b-5302-46a0-be93-ac530455dbde</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I can&amp;#39;t really tell you until you answer my initial question, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74540?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 20:07:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c3cf6ad5-d758-4c3b-8fec-c24e8424b10a</guid><dc:creator>kasiss0001</dc:creator><description>&lt;p&gt;Can I get some tips .&amp;nbsp;&lt;br /&gt;any explanation will be really helpful .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Indexing array in the grid</title><link>https://community.appian.com/thread/74539?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2020 20:05:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cd3945fc-ccda-44b3-a9bd-d0cd83dba1da</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;What version of Appian are you using?&amp;nbsp; Doing this gets significantly easier in versions 19.2 and later, using the new revamped paging grid component.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>