<?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 reference other inputs in multiselect's dynamic query in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568456#M46679</link>
    <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;I am creating a Splunk dashboard and have some questions regarding the multiselect input.&lt;/P&gt;&lt;P&gt;1. I want to add a special option `all`, when user selects it, means all options are selected. So I added a static option `all`, but I can select both `all` and any other options, makes it looks odd, so my first question is how to make `all` option either exclusive of other options, or when i select `all`, all options will be selected automatically (except `all`)?&lt;/P&gt;&lt;P&gt;2. For the multiselect input, I am currently using is int a `WHERE` clause: `| where $multiselect_roles$`, currently the configuration of multiselect is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="codewarrior_0-1632529389700.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16158i46D2EF0FDD35955C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="codewarrior_0-1632529389700.png" alt="codewarrior_0-1632529389700.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it means the interpolated clause looks like: `| where role_name="value1" OR role_name="value2"`, my second question is when `all` is selected, how can I&amp;nbsp;&lt;SPAN&gt;either emit the whole `&lt;/SPAN&gt;WHERE`&lt;SPAN&gt;&amp;nbsp;clause, or make it trivial, means the `&lt;/SPAN&gt;WHERE`&lt;SPAN&gt;&amp;nbsp;clause is there but actually it doesn’t filter anything? I tried to give&amp;nbsp;the `all` option an empty string, or a `*` but both don’t work.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3. When populating the dynamic options of multiselect from query, I want to reference other inputs as query parameters.&lt;/P&gt;&lt;P&gt;For example, I already added an input whose token name is `environment` and another time range input, I want to only get distinct values of a column from the given environment and time range, like this:&lt;/P&gt;&lt;PRE&gt;`from_index_distapps` sourcetype="xyz" "request=" earliest=$time_range$
| rex field=message "request=\"(?[^}]+})"
| eval arjson=replace(arjson, "\\\\\"", "\"")
| spath input=arjson
| where environment=$environment$
| table role_name
| dedup role_name&lt;/PRE&gt;&lt;P&gt;How to correctly reference other inputs here?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Sep 2021 00:35:18 GMT</pubDate>
    <dc:creator>codewarrior</dc:creator>
    <dc:date>2021-09-25T00:35:18Z</dc:date>
    <item>
      <title>How to reference other inputs in multiselect's dynamic query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568456#M46679</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;I am creating a Splunk dashboard and have some questions regarding the multiselect input.&lt;/P&gt;&lt;P&gt;1. I want to add a special option `all`, when user selects it, means all options are selected. So I added a static option `all`, but I can select both `all` and any other options, makes it looks odd, so my first question is how to make `all` option either exclusive of other options, or when i select `all`, all options will be selected automatically (except `all`)?&lt;/P&gt;&lt;P&gt;2. For the multiselect input, I am currently using is int a `WHERE` clause: `| where $multiselect_roles$`, currently the configuration of multiselect is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="codewarrior_0-1632529389700.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16158i46D2EF0FDD35955C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="codewarrior_0-1632529389700.png" alt="codewarrior_0-1632529389700.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it means the interpolated clause looks like: `| where role_name="value1" OR role_name="value2"`, my second question is when `all` is selected, how can I&amp;nbsp;&lt;SPAN&gt;either emit the whole `&lt;/SPAN&gt;WHERE`&lt;SPAN&gt;&amp;nbsp;clause, or make it trivial, means the `&lt;/SPAN&gt;WHERE`&lt;SPAN&gt;&amp;nbsp;clause is there but actually it doesn’t filter anything? I tried to give&amp;nbsp;the `all` option an empty string, or a `*` but both don’t work.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3. When populating the dynamic options of multiselect from query, I want to reference other inputs as query parameters.&lt;/P&gt;&lt;P&gt;For example, I already added an input whose token name is `environment` and another time range input, I want to only get distinct values of a column from the given environment and time range, like this:&lt;/P&gt;&lt;PRE&gt;`from_index_distapps` sourcetype="xyz" "request=" earliest=$time_range$
| rex field=message "request=\"(?[^}]+})"
| eval arjson=replace(arjson, "\\\\\"", "\"")
| spath input=arjson
| where environment=$environment$
| table role_name
| dedup role_name&lt;/PRE&gt;&lt;P&gt;How to correctly reference other inputs here?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 00:35:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568456#M46679</guid>
      <dc:creator>codewarrior</dc:creator>
      <dc:date>2021-09-25T00:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference other inputs in multiselect's dynamic query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568457#M46680</link>
      <description>&lt;P&gt;PS why are the backquotes not covered into &amp;lt;code&amp;gt; &amp;lt;/code&amp;gt; automatically?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 00:33:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568457#M46680</guid>
      <dc:creator>codewarrior</dc:creator>
      <dc:date>2021-09-25T00:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference other inputs in multiselect's dynamic query</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568465#M46681</link>
      <description>&lt;P&gt;Set your multi-select something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;      &amp;lt;input type="multiselect" token="roles"&amp;gt;
        &amp;lt;label&amp;gt;Select one or more roles&amp;lt;/label&amp;gt;
        &amp;lt;choice value="All"&amp;gt;All&amp;lt;/choice&amp;gt;
        &amp;lt;search base="find_roles"&amp;gt;
          &amp;lt;query&amp;gt;dedup roles | table roles&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;fieldForLabel&amp;gt;roles&amp;lt;/fieldForLabel&amp;gt;
        &amp;lt;fieldForValue&amp;gt;roles&amp;lt;/fieldForValue&amp;gt;
        &amp;lt;prefix&amp;gt;(&amp;lt;/prefix&amp;gt;
        &amp;lt;valuePrefix&amp;gt;role="&amp;lt;/valuePrefix&amp;gt;
        &amp;lt;valueSuffix&amp;gt;"&amp;lt;/valueSuffix&amp;gt;
        &amp;lt;delimiter&amp;gt; OR &amp;lt;/delimiter&amp;gt;
        &amp;lt;suffix&amp;gt;)&amp;lt;/suffix&amp;gt;
        &amp;lt;default&amp;gt;All&amp;lt;/default&amp;gt;
        &amp;lt;change&amp;gt;
          &amp;lt;eval token="form.roles"&amp;gt;case(mvcount('form.roles')=0,"All",mvcount('form.roles')&amp;amp;gt;1 AND mvfind('form.roles',"All")&amp;amp;gt;0,"All",mvcount('form.roles')&amp;amp;gt;1 AND mvfind('form.roles',"All")=0,mvfilter('form.roles'!="All"),1==1,'form.roles')&amp;lt;/eval&amp;gt;
          &amp;lt;eval token="multiselect_roles"&amp;gt;if(mvfind('form.roles',"All")=0,"role=*",$roles$)&amp;lt;/eval&amp;gt;
        &amp;lt;/change&amp;gt;
      &amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Note that the eval with the case statement has to be all on one line. Also, note that the value for All is All since it is the value not the label that is held in form.roles not the label.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 08:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-reference-other-inputs-in-multiselect-s-dynamic-query/m-p/568465#M46681</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-25T08:37:09Z</dc:date>
    </item>
  </channel>
</rss>

