<?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>Editable Grid - Dynamic columns</title><link>https://community.appian.com/discussions/f/user-interface/19331/editable-grid---dynamic-columns</link><description>Hi, 
 
 I have a requirement in which the user enters any numerical value, let&amp;#39;s say 4, so a grid should be created with four columns. Likewise, he can enter n values, so n columns should be created. 
 please let me know the implementation.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Editable Grid - Dynamic columns</title><link>https://community.appian.com/thread/75630?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 10:36:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2eaa038d-5c21-4820-92bf-8df405578e97</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;I think based on my example you should be able to work out what to do, it&amp;#39;s the same concept just different syntax. Give it a go and see how you get on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable Grid - Dynamic columns</title><link>https://community.appian.com/thread/75628?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 10:23:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:de0f961c-b4fb-484d-9d38-b4b9c8986bdc</guid><dc:creator>baji mekala</dc:creator><description>&lt;p&gt;&amp;nbsp;Hi&amp;nbsp;Stewart Burchell,&lt;/p&gt;
&lt;p&gt;Is there any snippet for a!gridLayout()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable Grid - Dynamic columns</title><link>https://community.appian.com/thread/75624?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 09:56:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc494451-ea42-4d16-86b5-a02afa6ee729</guid><dc:creator>baji mekala</dc:creator><description>&lt;p&gt;&lt;span&gt;hey, thanks, this is exactly what I needed.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Editable Grid - Dynamic columns</title><link>https://community.appian.com/thread/75622?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 09:52:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7e47c578-0b65-48a3-a754-ee4d8b93b889</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;SAIL components can be dynamically generated within the scope of a loop - you can use a!forEach() here. So you can have one component that the User can use to choose how many columns a grid should have, and the gird can use that number entered/selected to dynamically generate the columns within the grid. But that&amp;#39;s by far the easiest part of the implementation, what is going to be much more complex are&amp;nbsp;how to ensure they don&amp;#39;t select 1 million columns, or a negative number of columns; or how to &amp;#39;type&amp;#39; the column (text, drop-down, integer, decimal); or (finally) how to map the content of the columns&amp;nbsp;so that the data entered can be persisted to a database (assuming that&amp;#39;s what you&amp;#39;re intending).&lt;/p&gt;
&lt;p&gt;Anyway, enough of the doom and gloom. Here&amp;#39;s a snippet to get you going:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!numerOfColumns: null,
  {
    a!dropdownField(
      label: &amp;quot;Number of Columns&amp;quot;,
      value: local!numerOfColumns,
      saveInto: local!numerOfColumns,
      choiceLabels: fn!enumerate(10)+1,
      choiceValues: fn!enumerate(10)+1,
      placeholderLabel: &amp;quot;--- Select the Number of Columns required ---&amp;quot;
    ),
    a!gridField(
      showWhen: fn!not(fn!isnull(local!numerOfColumns)),
      columns: a!forEach(
        items: fn!enumerate(local!numerOfColumns)+1,
        expression: a!gridColumn(
          label: concat(&amp;quot;Column &amp;quot;, fv!item)
        )
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>