<?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>Grid Link and display text</title><link>https://community.appian.com/discussions/f/user-interface/20146/grid-link-and-display-text</link><description>I have a grid field with links in multiple rows. Based on the selected link, a text field should be displayed. But, here&amp;#39;s a twist, For eg, I have 3 links: Link 1, link2, link3. 
 On selecting link 1, data should be displayed based on the selection. On</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Grid Link and display text</title><link>https://community.appian.com/thread/78725?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 13:35:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6776f45c-725e-43b6-8cf5-aebd3ad40e9b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Ah, I missed that piece in my implementation somehow.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s pretty simple to add using a little if() logic in the link saveInto, however:&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!richTextDisplayField(
  value: a!richTextItem(
    text: fv!row.id,
    link: a!dynamicLink(
      value: fv!row.id,
      saveInto: {
        a!save(
          local!selectedId,
          if(
            local!clicked,
            if(
              local!selectedId = fv!row.id,
              null(),
              fv!row.id
            ),
            fv!row.id
          )
        )
      }
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Grid Link and display text</title><link>https://community.appian.com/thread/78713?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 06:40:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f15ca493-676d-4d9b-a6de-6896905c5873</guid><dc:creator>ankitab254</dc:creator><description>&lt;p&gt;Hi @normanc, Thanks for your answer. However, This solution does not hide the display text. The requirement is, when I click link 1, value should be shown, when I click it again, it should be hidden. But, instead of clicking it again, if I click Link2, the corresponding value should be displayed.&lt;/p&gt;
&lt;p&gt;I way I coded local!click was doing the same thing, but it was taking 2 clicks to display the second value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Grid Link and display text</title><link>https://community.appian.com/thread/78712?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 06:37:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bb5fe6ed-6c08-4c5e-a304-6c1af440c0b4</guid><dc:creator>ankitab254</dc:creator><description>&lt;p&gt;Hi Mike, Thanks for your answer and your tip on the link field. This solution does not hide the display text. The requirement is, when I click link 1, value should be shown, when I click it again, it should be hidden. But, instead of clicking it again, if I click Link2, the corresponding value should be displayed.&lt;/p&gt;
&lt;p&gt;I way I coded local!click was doing the same thing, but it was taking 2 clciks to display the second value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Grid Link and display text</title><link>https://community.appian.com/thread/78711?ContentTypeID=1</link><pubDate>Tue, 29 Dec 2020 20:27:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3d468abd-bbb7-43b5-a630-e997d6f31920</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Here&amp;#39;s how I&amp;#39;d suggest you re-write the above code:&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!gridData: todatasubset({ { id: 1 }, { id: 2 }, { id: 3 } }),
  local!selectedId: tointeger(null()),
  local!clicked: not(isnull(local!selectedId)),
  local!display: {
    { id: 1, name: &amp;quot;abc&amp;quot; },
    { id: 2, name: &amp;quot;pqr&amp;quot; }
  },
  {

    a!gridField(
      label:&amp;quot;Click Links&amp;quot;,
      data:local!gridData.data,
      columns: {
        a!gridColumn(
          label:&amp;quot;Link&amp;quot;,
          value: a!richTextDisplayField(
            value: a!richTextItem(
              text: fv!row.id,
              link: a!dynamicLink(
                value: fv!row.id,
                saveInto: {
                  local!selectedId
                }
              )
            )
          )
          /*a!linkField(*/
            /*label: fv!row.id,*/
            /*links: a!dynamicLink(*/
              /*label: fv!row.id,*/
              /*value: fv!row.id,*/
              /*saveInto: {*/
                /*local!selectedId,*/
                /*a!save(*/
                  /*local!clicked,*/
                  /*if(local!clicked, false, true)*/
                /*)*/
              /*}*/
            /*)*/
          /*)*/
        )
      }     
    ),
    a!textField(
      label: index(
        local!display.name,
        wherecontains(
          local!selectedId,
          tointeger(local!display.id)
        )
      ),
      showWhen: local!clicked
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here we make use of the auto-updating nature of a!localVariables() values by setting &amp;quot;local!clicked&amp;quot; to simply key off of whether there&amp;#39;s an ID selected.&amp;nbsp; That way, you don&amp;#39;t need to waste an extra saveInto (and the accompanying if() logic surrounding it to determine its new value).&lt;/p&gt;
&lt;p&gt;Also - don&amp;#39;t use a!linkField.&amp;nbsp; We have &lt;em&gt;a!richTextDisplayField()&lt;/em&gt; now and it&amp;#39;s far more usable, more flexible, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Grid Link and display text</title><link>https://community.appian.com/thread/78709?ContentTypeID=1</link><pubDate>Tue, 29 Dec 2020 17:10:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:46ad5012-31b1-4f38-97e1-07786867f9c5</guid><dc:creator>normanc</dc:creator><description>&lt;p&gt;I would remove the local!clicked toggle and change the showWhen to:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;showWhen: contains(tointeger(local!display.id), tointeger(local!selectedId))&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>