Dashboards & Visualizations

How to drilldown all selected choices from one multiselect input form to another multiselect input form?

koprai
Explorer

I have 2 forms say "High Level Form" and "Details Form". Both these forms have multiselect input say "Common input". User could have chosen multiple choices for "Common input" at the "High Level Form". I would like to find out a way to carry these multiple choices for "Common input" from "High Level Form" when drilldown-ed to "Details Form". Would really appreciate any inputs on this.

mikaelbje
Motivator

I'd also love to hear how this can be solved in a proper way.

0 Karma

altink
Builder

I have the same problem too.

0 Karma

David
Splunk Employee
Splunk Employee

This is a very ugly workaround.. but I needed this for one use case. My multi-select token was sh_clause, which was a listing of N number of search heads (I figure 7 is as much as I'd ever likely see).

I built a javascript with the following:

require(['splunkjs/mvc','splunkjs/mvc/utils','splunkjs/mvc/simplexml/ready!'], function(mvc, utils){
                            var unsubmittedTokens = mvc.Components.getInstance('default');
                            var submittedTokens = mvc.Components.getInstance('submitted');

submittedTokens.on('change:sh_clause', function () {

    /* Example contents of "sh_clause":  (SearchHead=MySH1 OR SearchHead=MySH2 OR SearchHead=MySH3) */
    var cur_metric = submittedTokens.get("sh_clause");
    var myvar = "DummySH"
    if(cur_metric == "(SearchHead=*)"){
        myvar = "*"
        console.log("Using a generic SearchHead")
    }
    var regex1 = new RegExp(" OR ", "g")
    var regex2 = new RegExp("SearchHead=", "g")
    var shs = cur_metric.replace("(", "").replace(")", "").replace(regex2,"").split(" OR ")
    for(i=0; i<7; i++){
        unsubmittedTokens.set("shlink" + (i+1), "DummySH")
    }
    for(i=0; i<shs.length; i++){
        unsubmittedTokens.set("shlink" + (i+1), shs[i])
    }

    submittedTokens.set(unsubmittedTokens.toJSON());

})});

Then the drilldown becomes:

    <drilldown>
      <link>
        <![CDATA[/app/myApp/myView?form.sh_clause=$shlink1$&form.sh_clause=$shlink2$&form.sh_clause=$shlink3$&form.sh_clause=$shlink4$&form.sh_clause=$shlink5$&form.sh_clause=$shlink6$&form.sh_clause=$shlink7$&form.field1.earliest=$field1.earliest$&form.field1.latest=$field1.latest$]]>
      </link>
    </drilldown>

Whenever there is a change to the sh_clause multi-select, it goes and sets the value of shlink1 through shlink7. If sh_clause is equal to all (the default in my use case), it will leave shlink1..7 to * and the user will be none the wiser. If someone does select a SH, because I don't know how many they -might- select, I set the others to "DummySH." DummySH does show up on the destination form -- I'm not particularly concerned for my use case, where my multi-selects are an explicit OR, it will just be ignored. If you wanted to, you could copy-paste that code just strip out the DummySH from sh_clause on the far side.

As I opened with, this is very ugly.. but it does meet a specific need.

0 Karma

koprai
Explorer

Just pinging to see if anybody has solved this..

0 Karma

rjthibod
Champion

I too would like to know the answer to this question.

0 Karma

koprai
Explorer

Just to clarify ... I have 2 different forms (dashboards) and not 2 inputs in a single form (dashboard). Lets name the 2 different forms (dashboards) "High Level Form" and "Details Form". When user is clicking a panel in the "High level Form", the drilldown link takes the user to the "Details Form". All that is straighforward.

The difficult part is both these forms have a multi-select input say "Common Input". An user could have selected 1, 2 or 3 values for the multi-select "Common Input" in "High level form".. now I would like the drilldown to "Details form" also take those 1,2 or 3 values. The difficult part is how I can construct the drilldown url so that those variable number of values can be carried over

It would have been easy if url encoding for multiselect forms were designed by Splunk like "form.token=aggregatedTokenValue" instead of "form.token=value1&form.token=value2&form.token=value3....etc".

0 Karma

ngatchasandra
Builder

Hi,
To allow drilldown when the user select their choice in other multiSelect, Only send values when the user select to this another multiSelect .
Here is an example with _internal index.
If I select Sourcetype=splunkd and Component=LMStack, the source input will populating own with only source that match this sourcetype and this component.

<form>
  <label>Dashboard_Filter</label>
  <fieldset submitButton="false">
    <input type="multiselect" token="sourcetype" searchWhenChanged="true">
      <label>Sourcetype</label>
      <search>
        <query>index=_internal | stats count by sourcetype</query>
      </search>
      <fieldForLabel>sourcetype</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <prefix>(</prefix>
      <suffix>)</suffix>
      <valuePrefix>sourcetype="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter>OR</delimiter>
      <choice value="*">All</choice>
      <default>*</default>
    </input>
    <input type="multiselect" token="component" searchWhenChanged="true">
      <label>Select component</label>
      <search>
        <query>index=_internal|stats count by component</query>
      </search>
      <fieldForLabel>component</fieldForLabel>
      <fieldForValue>component</fieldForValue>
      <prefix>(</prefix>
      <suffix>)</suffix>
      <valuePrefix>component="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter>OR</delimiter>
      <choice value="*">All</choice>
      <default>*</default>
    </input>
    <input type="multiselect" token="source" searchWhenChanged="true">
      <label>Source</label>
      <search>
        <query>index=_internal |search $sourcetype$ $component$|stats count by source</query>
      </search>
      <fieldForLabel>source</fieldForLabel>
      <fieldForValue>source</fieldForValue>
      <prefix>(</prefix>
      <suffix>)</suffix>
      <valuePrefix>source="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter>OR</delimiter>
      <default>*</default>
      <choice value="*">All</choice>
    </input>
  </fieldset>
  <row>
    <panel>
      <chart>
        <title>Count_by_sourcetype</title>
        <search>
          <query>index=_internal $sourcetype$ $component$| stats count by source </query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="charting.chart">column</option>
        <option name="charting.axisY2.enabled">undefined</option>
      </chart>
    </panel>
  </row>
</form>

Sorry for my English.

0 Karma

koprai
Explorer

Thanks for your response.. Maybe I was not very clear in my question. I have 2 different forms (dashboards) and not 2 inputs in a single form (dashboard). Lets name the 2 different forms (dashboards) "High Level Form" and "Details Form". When user is clicking a panel in the "High level Form", the drilldown link takes the user to the "Details Form". All that is straighforward.

The difficult part is both these forms have a multi-select input say "Common Input". An user could have selected 1, 2 or 3 values for the multi-select "Common Input" in "High level form".. now I would like the drilldown to "Details form" also take those 1,2 or 3 values. The difficult part is how I can construct the drilldown url so that those variable number of values can be carried over

It would have been easy if url encoding for multiselect forms were designed by Splunk like "form.token=aggregatedTokenValue" instead of "form.token=value1&form.token=value2&form.token=value3....etc". I

Anybody else have solved this usecase?

Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...