<?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>How to create dynamic Tabs</title><link>https://community.appian.com/discussions/f/user-interface/20877/how-to-create-dynamic-tabs</link><description>Hi All 
 
 I have a requirement to create dynamic tabs based on certain conditions. 
 I tried below code but is not working. 
 The foreach in choose section is not returning the list. 
 { a!localVariables( local!selectedTab: 1, local!names: {&amp;quot;1&amp;quot;, &amp;quot;2&amp;quot;</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to create dynamic Tabs</title><link>https://community.appian.com/thread/81299?ContentTypeID=1</link><pubDate>Fri, 30 Apr 2021 20:18:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8e1ef9f6-73a1-4058-ae7b-5648f4f0021c</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Great!&amp;nbsp; Feel free to mark&amp;nbsp;this thread as answered if you would be so kind :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create dynamic Tabs</title><link>https://community.appian.com/thread/81298?ContentTypeID=1</link><pubDate>Fri, 30 Apr 2021 20:05:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:40ba2780-7206-494c-b125-29db50887af5</guid><dc:creator>HPaul</dc:creator><description>&lt;p&gt;Thanks Chris . It worked&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create dynamic Tabs</title><link>https://community.appian.com/thread/81296?ContentTypeID=1</link><pubDate>Fri, 30 Apr 2021 19:43:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f10c8ef1-81a5-4ffc-a5e6-0432decbb72a</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;The issue here is with the use of the choose() function, I do not believe we will be able to dynamically add choice parameters since they&amp;nbsp;will be treated as one choice of a list of items.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, you can accomplish this in a few ways - this solution builds a list of a!sectionLayout(), which are only shown when the selectedTab matches fv!index of the a!forEach():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!selectedTab: 1,
  local!names: {&amp;quot;1&amp;quot;, &amp;quot;2&amp;quot;, &amp;quot;3&amp;quot;},
  {
    a!buttonArrayLayout(
      buttons: {
        a!forEach(
          items: local!names,
          expression: a!localVariables(
            local!modified,
            a!buttonWidget(
              label: &amp;quot;Tab1 &amp;quot;&amp;amp;fv!item,
              saveInto: {a!save(local!selectedTab, fv!item)},
              size: &amp;quot;SMALL&amp;quot;,
              style: if(local!selectedTab = fv!item, &amp;quot;PRIMARY&amp;quot;, &amp;quot;LINK&amp;quot;)
            ),
          )
        )
      }
    ),
    {
      a!forEach(
        items: local!names,
        expression: a!sectionLayout(
          showWhen: fv!index=local!selectedTab,
          contents: {
            a!textField(
              label: concat(&amp;quot;Enter Data &amp;quot;,fv!item)
            )
          }
        )
      )
    }
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Also, when posting code snippets please take advantage of the &lt;em&gt;&lt;strong&gt;Insert -&amp;gt; Code&lt;/strong&gt;&lt;/em&gt; feature for readability.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>