Dashboards & Visualizations

How to remove a token name when the token has no value?

morethanyell
Builder

We're working on an HTML table with <td> that displays value of token (such that <td>$token1$</td>). We don't know how to remove the token name $token1$ when we deselect from the inputfield. Here's a clearer picture:

alt text

But when we deselect, the token name appears! How do we solve this?

alt text

Thanks in advance!

0 Karma
1 Solution

niketn
Legend

@morethanyell please add the following change event handler to your Dropdown input and test.

  <change>
    <condition match="isnull($value$)">
      <set token="token1"></set>
      <set token="token2"></set>          
    </condition>
    <condition>
      <set token="token1">$label$</set>
      <set token="token2">$value$</set>
    </condition>
  </change>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@morethanyell please add the following change event handler to your Dropdown input and test.

  <change>
    <condition match="isnull($value$)">
      <set token="token1"></set>
      <set token="token2"></set>          
    </condition>
    <condition>
      <set token="token1">$label$</set>
      <set token="token2">$value$</set>
    </condition>
  </change>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

bgennerm
Engager

you can even do this with the same token:



if(isnull($value$),"blank or other text", $token1$)


harishalipaka
Motivator

hi @morethanyell

If you want to blank that cell when it has no value ,dynamically add blank for token value when it is null.

Thanks
Harish

morethanyell
Builder

how is this done? sorry i'm new.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

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 ...