Dashboards & Visualizations

How to get a token to only display on a label if set via a drilldown on a form?

bcronrath
Path Finder

I have a dashboard which includes a grid, that when a row is clicked, displays info in graphs below that based on what you clicked. What I want to do is label those graphs below with the token value that is being passed in so that they have a label for what they are looking at. Let's say the token is $Name_tok$. I set the label to have $Name_tok$ in the name, and while it does work fine for when I click the drilldown options, initially it just displays literally as $Name_tok$ which is not what I'd like to see, I'd rather just have no text in that space. I've tried doing the following at the top of the page but it doesn't appear to work:

    <init>
      <set token="Name_tok"> </set>
    </init>

Does anyone know of a way to accomplish this?
I'm on Splunk 6

0 Karma
1 Solution

gokadroid
Motivator

Try to set the token in drilldown since you want token to be passed on clicking a value. What you should be looking at is something as follows:

< row>
< panel>
< table>
< title> This is the chart on which you will click a row < /title>
< search>
< query>yourQuery that populates this panel table< /query>
< earliest>earliestTIme< /earliest>
< latest>latestTime< /latest>
< /search>

< drilldown>
< set token="Name_tok">$click.value$< /set>
< /drilldown>

:
:other table options
< /table>
< /panel>
< panel>
** < chart depends="$Name_tok$">
< title>Title of the chart where the click is reflected in $Name_tok$< /title>
< search>
< query>your serach query making use of $Name_tok$ as that is what was clicked.< /query> **
< earliest>earliestTime< /earliest>
< latest>latestTime< /latest>
< /search>
:
:other chart options
< /chart>
< /panel>
< /row>

< drilldown> , < set token> and $click.value$ ensure that token is set on clicking a value
< chart depends="$Name_tok$"> ensures chart is only shown up once the token is set. Use the token then in title, search or wherever you want once it is set.

Note: Please remove the leading space in each of the tags, like < drillown>, as I do not know how to put tags without spaces in the answer 🙂

View solution in original post

gokadroid
Motivator

Try to set the token in drilldown since you want token to be passed on clicking a value. What you should be looking at is something as follows:

< row>
< panel>
< table>
< title> This is the chart on which you will click a row < /title>
< search>
< query>yourQuery that populates this panel table< /query>
< earliest>earliestTIme< /earliest>
< latest>latestTime< /latest>
< /search>

< drilldown>
< set token="Name_tok">$click.value$< /set>
< /drilldown>

:
:other table options
< /table>
< /panel>
< panel>
** < chart depends="$Name_tok$">
< title>Title of the chart where the click is reflected in $Name_tok$< /title>
< search>
< query>your serach query making use of $Name_tok$ as that is what was clicked.< /query> **
< earliest>earliestTime< /earliest>
< latest>latestTime< /latest>
< /search>
:
:other chart options
< /chart>
< /panel>
< /row>

< drilldown> , < set token> and $click.value$ ensure that token is set on clicking a value
< chart depends="$Name_tok$"> ensures chart is only shown up once the token is set. Use the token then in title, search or wherever you want once it is set.

Note: Please remove the leading space in each of the tags, like < drillown>, as I do not know how to put tags without spaces in the answer 🙂

rjthibod
Champion

@gokadroid you can avoid the spaces around the tags by putting your xml segment in a code block.

When you are typing out an answer you should see a button on the formatting options toolbar that looks like two rows of binary numbers. Click that button and another window will appear where you can type/paste your code block in XML without needing to add the spaces.

bcronrath
Path Finder

Ah ok, did not know about the "depends" attribute - perfect this works, thank you!

0 Karma

gokadroid
Motivator

OH WOW!!! You have enlightened me for real...thanks a lot!!

0 Karma

sundareshr
Legend

Since the chart is also dependent on the token value being set, why not hide the entire panel. You can do that by adding depends="$Name_tok$" to the panel tag like this

<panel depends="$Name_tok$"><chart>.....</chart></panel>
0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...