<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to dynamically change cell color based on multi-select input token? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-dynamically-change-cell-color-based-on-multi-select-input/m-p/466601#M30596</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a multi-select input with user permissions to change cell color ( &lt;CODE&gt;colorPalette&lt;/CODE&gt;) based on values the user enters.&lt;BR /&gt;Here is the creation of my multi-select input :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="multiselect" token="chosenAdmin" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
        &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
        &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;my query
          &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;delimiter&amp;gt; &amp;lt;/delimiter&amp;gt;
      &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is the color palette I tried:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;format type="color" field="user"&amp;gt;
          &amp;lt;colorPalette type="expression"&amp;gt;if (match(value, $chosenAdmin$),"#DC4E41", true())&amp;lt;/colorPalette&amp;gt;
 &amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The &lt;CODE&gt;$chosenAdmin$&lt;/CODE&gt; token can contain 1 or more users.&lt;BR /&gt;This changes the color of all cells of my "user" to red.&lt;/P&gt;
&lt;P&gt;Any idea how to solve this problem?&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jun 2020 23:47:39 GMT</pubDate>
    <dc:creator>marone</dc:creator>
    <dc:date>2020-06-07T23:47:39Z</dc:date>
    <item>
      <title>How to dynamically change cell color based on multi-select input token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-dynamically-change-cell-color-based-on-multi-select-input/m-p/466601#M30596</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have a multi-select input with user permissions to change cell color ( &lt;CODE&gt;colorPalette&lt;/CODE&gt;) based on values the user enters.&lt;BR /&gt;Here is the creation of my multi-select input :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="multiselect" token="chosenAdmin" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
        &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
        &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;my query
          &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;delimiter&amp;gt; &amp;lt;/delimiter&amp;gt;
      &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is the color palette I tried:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;format type="color" field="user"&amp;gt;
          &amp;lt;colorPalette type="expression"&amp;gt;if (match(value, $chosenAdmin$),"#DC4E41", true())&amp;lt;/colorPalette&amp;gt;
 &amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The &lt;CODE&gt;$chosenAdmin$&lt;/CODE&gt; token can contain 1 or more users.&lt;BR /&gt;This changes the color of all cells of my "user" to red.&lt;/P&gt;
&lt;P&gt;Any idea how to solve this problem?&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2020 23:47:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-dynamically-change-cell-color-based-on-multi-select-input/m-p/466601#M30596</guid>
      <dc:creator>marone</dc:creator>
      <dc:date>2020-06-07T23:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically change cell color based on multi-select input token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-dynamically-change-cell-color-based-on-multi-select-input/m-p/466602#M30597</link>
      <description>&lt;P&gt;@marone besides applying the expression string from multiselect as token, you will also need to ensure that table visualization is refreshed every time multiselect value is changed (this can be done through JS). So, instead I am giving a Link input as submit button which resets the token so that search is re-run and table gets refreshed.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9002i86DEEB24CA0FAB84/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Following is the Simple XML run anywhere example which you can try and confirm!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Highlight Selected values in Table&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="multiselect" token="chosenAdmin" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select User to Highlight in the table&amp;lt;/label&amp;gt;
      &amp;lt;delimiter&amp;gt; &amp;lt;/delimiter&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;unset token="refresh"&amp;gt;&amp;lt;/unset&amp;gt;
      &amp;lt;/change&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval user="UserA,UserB,UserC,UserD,UserE,UserF,UserG,UserH"
| makemv user delim=","
| mvexpand user&amp;lt;/query&amp;gt;
      &amp;lt;/search&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input id="button_submit1" type="link" token="tokLinkSubmit" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;choice value="submit"&amp;gt;Submit&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="submit"&amp;gt;
          &amp;lt;set token="refresh"&amp;gt;true&amp;lt;/set&amp;gt;
          &amp;lt;unset token="form.tokLinkSubmit"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html depends="$alwaysHideCSSPanel$"&amp;gt;
         &amp;lt;style&amp;gt;
           div[id^="button_submit"] div[data-component="splunk-core:/splunkjs/mvc/components/LinkList"]{
               width:40% !important;
           }
           div[id^="button_submit"] button[data-test="option"]{
               padding: 6px 15px;
               font-weight: 500;
               background-color: #5cc05c;
               border: transparent;
           }
           div[id^="button_submit"] span[data-test="label"]{
               color: white !important;
           }
           div[id^="button_submit"] span[data-test="label"]:hover{
               color: #3c444d !important;
           }
         &amp;lt;/style&amp;gt;
       &amp;lt;/html&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search depends="$refresh$"&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval user="UserA,UserB,UserC,UserD,UserA,UserE,UserC,UserF,UserA,UserB,UserG,UserH"
| makemv user delim=","
| mvexpand user&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;format type="color" field="user"&amp;gt;
          &amp;lt;colorPalette type="expression"&amp;gt;if (like("$chosenAdmin$",value),"#DC4E41","#FFFFFF")&amp;lt;/colorPalette&amp;gt;
        &amp;lt;/format&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 May 2020 16:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-dynamically-change-cell-color-based-on-multi-select-input/m-p/466602#M30597</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-05-30T16:49:56Z</dc:date>
    </item>
  </channel>
</rss>

