Dashboards & Visualizations

Display Panel based on two different Inputs

ravichandra49
New Member

I have two Inputs, One is dropdown which specifies the type of File Incoming or Outgoing and another is Radio button which has three levels of SLA like Met, Warn, Breach. I want to display different panels based on different combinations of file type that can be selected using dropdown and level of SLA. How to check the values set by both tokens Change condition using match.

Labels (1)
0 Karma

@ravichandra49 you can create an independent search which can handle the values from both inputs and depending on combinations can set/unset required tokens to display.

 

Screen Shot 2020-06-23 at 11.09.56 PM.png

 

Following is a run anywhere example that you can try and confirm!

<form>
  <label>Display Panels based on inputs</label>
  <fieldset submitButton="false" autoRun="true">
    <input type="dropdown" token="direction" searchWhenChanged="true">
      <label>Direction</label>
      <choice value="in">Inbound</choice>
      <choice value="out">Outbound</choice>
      <default>in</default>
    </input>
    <input type="radio" token="sla" searchWhenChanged="true">
      <label>SLA</label>
      <choice value="met">Met</choice>
      <choice value="warn">Warn</choice>
      <choice value="breach">Breach</choice>
      <default>breach</default>
    </input>
  </fieldset>
  <search>
    <query>| makeresults
    | eval selection="$direction$"."_"."$sla$"
    </query>
    <done>
      <condition match="$result.selection$==&quot;in_breach&quot;">
        <set token="in_breach">true</set>
        <unset token="in_warn"></unset>
        <unset token="in_met"></unset>
        <unset token="out_breach"></unset>
        <unset token="out_warn"></unset>
        <unset token="out_met"></unset>
      </condition>
      <condition match="$result.selection$==&quot;in_warn&quot;">
        <unset token="in_breach"></unset>
        <set token="in_warn">true</set>
        <unset token="in_met"></unset>
        <unset token="out_breach"></unset>
        <unset token="out_warn"></unset>
        <unset token="out_met"></unset>
      </condition>
      <condition match="$result.selection$==&quot;in_met&quot;">
        <unset token="in_breach"></unset>
        <unset token="in_warn"></unset>
        <set token="in_met">true</set>
        <unset token="out_breach"></unset>
        <unset token="out_warn"></unset>
        <unset token="out_met"></unset>
      </condition>
      <condition match="$result.selection$==&quot;out_breach&quot;">
        <unset token="in_breach"></unset>
        <unset token="in_warn"></unset>
        <unset token="in_met"></unset>
        <set token="out_breach">true</set>
        <unset token="out_warn"></unset>
        <unset token="out_met"></unset>
      </condition>
      <condition match="$result.selection$==&quot;out_warn&quot;">
        <unset token="in_breach"></unset>
        <unset token="in_warn"></unset>
        <unset token="in_met"></unset>
        <unset token="out_breach"></unset>
        <set token="out_warn">true</set>
        <unset token="out_met"></unset>
      </condition>
      <condition match="$result.selection$==&quot;out_met&quot;">
        <unset token="in_breach"></unset>
        <unset token="in_warn"></unset>
        <unset token="in_met"></unset>
        <unset token="out_breach"></unset>
        <unset token="out_warn"></unset>
        <set token="out_met">true</set>
      </condition>
    </done>
  </search>
  <row>
    <panel depends="$in_breach$">
      <title>Inbound Breach ($in_breach$)</title>
      <table>
        <search depends="$in_breach$">
          <query>| makeresults
          | fields - _time
          | eval Direction="$direction$",SLA="$sla$"</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$in_warn$">
      <title>Inbound Warning ($in_warn$)</title>
      <table>
        <search depends="$in_warn$">
          <query>| makeresults
          | fields - _time
          | eval Direction="$direction$",SLA="$sla$"</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$in_met$">
      <title>Inbound Met ($in_met$)</title>
      <table>
        <search depends="$in_met$">
          <query>| makeresults
          | fields - _time
          | eval Direction="$direction$",SLA="$sla$"</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$out_breach$">
      <title>Outbound Breach ($out_breach$)</title>
      <table>
        <search depends="$out_breach$">
          <query>| makeresults
          | fields - _time
          | eval Direction="$direction$",SLA="$sla$"</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$out_warn$">
      <title>Outbound Warning ($out_warn$)</title>
      <table>
        <search depends="$out_warn$">
          <query>| makeresults
          | fields - _time
          | eval Direction="$direction$",SLA="$sla$"</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$out_met$">
      <title>Outbound Met ($out_met$)</title>
      <table>
        <search depends="$out_met$">
          <query>| makeresults
          | fields - _time
          | eval Direction="$direction$",SLA="$sla$"</query>
          <earliest>$earliest$</earliest>
          <latest>$latest$</latest>
        </search>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
</form>

 

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Splunk Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...