<?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>Need to put shown condition in Button</title><link>https://community.appian.com/discussions/f/new-to-appian/21003/need-to-put-shown-condition-in-button</link><description>Hi All, 
 I&amp;#39;m having a button &amp;quot;COMPLETE&amp;quot; 
 i want to put a shown condition on it in the following basis 
 I&amp;#39;m having an array {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;}, 
 If both the values in that array are in completed status then only i want to show that button</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Need to put shown condition in Button</title><link>https://community.appian.com/thread/81821?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 05:56:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:10902572-48a8-4143-979f-a8198508bb59</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Another option using looping functions:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!allCompleted: {&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;},
  local!someOpen: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;,&amp;quot;Completed&amp;quot;},
  {
    assertTrue: all(exact(&amp;quot;Completed&amp;quot;, _), local!allCompleted),
    assertFalse: all(exact(&amp;quot;Completed&amp;quot;, _), local!someOpen),
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to put shown condition in Button</title><link>https://community.appian.com/thread/81817?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 20:51:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ad57794a-e017-4795-b703-935664a9f762</guid><dc:creator>Harris</dc:creator><description>&lt;p&gt;It worked, Thanks a lot Chris &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to put shown condition in Button</title><link>https://community.appian.com/thread/81813?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 20:10:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2dc89eed-42ca-4b5d-8cf2-678e5ce233a3</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Quick update using &amp;quot;disabled&amp;quot; vs &amp;quot;showWhen&amp;quot; (I prefer &amp;quot;disabled&amp;quot;).&amp;nbsp; Change the commenting on local!data lines and re-test to see it activate:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!data: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;,&amp;quot;Completed&amp;quot;},
  /*local!data: {&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;},*/

  {
    a!buttonArrayLayout(
      align: &amp;quot;CENTER&amp;quot;,
      buttons: a!buttonWidget(
        label: &amp;quot;COMPLETE&amp;quot;,
        disabled: not(
          count(wherecontains(&amp;quot;Completed&amp;quot;,local!data))=count(local!data)
        )
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to put shown condition in Button</title><link>https://community.appian.com/thread/81812?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 20:07:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:78c86df1-d0f8-41cb-bde3-6e6f14c95670</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Yes, no problem there.&amp;nbsp; This second example works for a dynamically sized array - using the wherecontains() function searching for Completed values, we check how many instances&amp;nbsp;are found against the total count of items in the array:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!data: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;,&amp;quot;Completed&amp;quot;},
  /*local!data: {&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;},*/

  {
    a!buttonArrayLayout(
      align: &amp;quot;CENTER&amp;quot;,
      buttons: a!buttonWidget(
        label: &amp;quot;COMPLETE&amp;quot;,
        showWhen: count(wherecontains(&amp;quot;Completed&amp;quot;,local!data))=count(local!data)
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to put shown condition in Button</title><link>https://community.appian.com/thread/81811?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 19:56:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:87e94fb8-c298-4db5-b5ec-87c4a5fb5e02</guid><dc:creator>Harris</dc:creator><description>&lt;p&gt;Thank you Chris,&lt;/p&gt;
&lt;p&gt;But my array won&amp;#39;t contain only 2 values always, they may increase the count of values but those are only Completed or not completed.&lt;/p&gt;
&lt;p&gt;If I can say clearly, if I&amp;#39;m having at least one value as not completed then&amp;nbsp;my button should be disabled.&lt;/p&gt;
&lt;p&gt;Hope I explained in a clear way?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Scenario&amp;#39;s like:&lt;/p&gt;
&lt;p&gt;{&amp;quot;Completed&amp;quot;,&lt;span&gt;&amp;quot;Completed&amp;quot;,&lt;/span&gt;&lt;span&gt;&amp;quot;Completed&amp;quot;,&lt;/span&gt;&lt;span&gt;&amp;quot;Completed&amp;quot;,&lt;/span&gt;&lt;span&gt;&amp;quot;Completed&amp;quot;,&amp;quot;&lt;strong&gt;Not Completed&lt;/strong&gt;&amp;quot;&lt;/span&gt;} ----&amp;gt;Button Should be Disabled&lt;/p&gt;
&lt;p&gt;{&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;,&amp;quot;Completed&amp;quot;} ----&amp;gt;Button Should be&amp;nbsp;Enable&lt;/p&gt;
&lt;p&gt;like so on..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to put shown condition in Button</title><link>https://community.appian.com/thread/81810?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 19:42:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6611837f-9b9d-405b-b057-a9ec7542a1a8</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;This is done utilizing the &amp;quot;showWhen&amp;quot; parameter.&amp;nbsp; This example assumes your array always contains 2 values, as noted in the original post, and includes dropdowns for you to change the array values to see it in action.&lt;/p&gt;
&lt;p&gt;Note that often instead of using the &amp;quot;showWhen&amp;quot; parameter to hide the button, I often use the &amp;quot;disabled&amp;quot; parameter so users know it exists, but does not let them press it until the desired values are present.&amp;nbsp; Comment out the showWhen code to see how that functionality works.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!data: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;},
  
  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!dropdownField(
              label: &amp;quot;Data 2&amp;quot;,
              labelPosition: &amp;quot;ADJACENT&amp;quot;,
              choiceLabels: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;},
              choiceValues: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;},
              value: local!data[1],
              saveInto: local!data[1]
            )
          }
        ),
        a!columnLayout(
          contents: {
            a!dropdownField(
              label: &amp;quot;Data 2&amp;quot;,
              labelPosition: &amp;quot;ADJACENT&amp;quot;,
              choiceLabels: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;},
              choiceValues: {&amp;quot;Completed&amp;quot;,&amp;quot;Not Completed&amp;quot;},
              value: local!data[2],
              saveInto: local!data[2]
            )
          }
        )
      }
    ),
    a!buttonArrayLayout(
      align: &amp;quot;CENTER&amp;quot;,
      buttons: a!buttonWidget(
        label: &amp;quot;COMPLETE&amp;quot;,
        showWhen: and(
          index(local!data,1,null)=&amp;quot;Completed&amp;quot;,
          index(local!data,2,null)=&amp;quot;Completed&amp;quot;
        ),
        disabled: or(
          index(local!data,1,null)&amp;lt;&amp;gt;&amp;quot;Completed&amp;quot;,
          index(local!data,2,null)&amp;lt;&amp;gt;&amp;quot;Completed&amp;quot;
        )
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>