Dashboards & Visualizations

How to edit my Simple XML to set a default value for the input time label token in my dashboard?

skota524
Explorer

Check the code attached below.
default time = 1 week window. Setting the drop-down label to "time_selected" token.

set token="time_selected" ==> $label$

When i open the dashboard, $time_selected$ = $label$
When i change the Time to (1 week window or All time), $time_selected$ = 1 week window.

Issue:
By default we set the time to 1 week window, but $label$ token is not set.
When we change the time, it's working fine.

Expected:
it to work by default.
When i open the dashboard, $time_selected$ should be "1 week window"

Code:
alt text

Any help is appreciated!

0 Karma

skota524
Explorer

Interesting, its the browser issue. Working fine on Chrome, but not on firefox.

Attaching the screenshots

Mozilla :
alt text

Chrome:
alt text

0 Karma

somesoni2
Revered Legend

The code in your question works for me Splunk 6.5. Here is the code that I used to test (run anywhere sample). What version of Splunk you're on?

<form>
  <label>TestsrchFilter</label>
  <fieldset submitButton="false">
    <input type="time" token="time" searchWhenChanged="true">
      <label>Select Time</label>
      <default>
        <earliest>rt-1w</earliest>
        <latest>rtnow</latest>
      </default>
      <change>
        <set token="selected_time">$label$</set>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>$selected_time$</title>
      <table>
        <search>
          <query>index=_internal | timechart span=1h count</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>
0 Karma

skota524
Explorer

Version is 6.3

I tried with 6.4 also. Still same issue.

0 Karma

skota524
Explorer

Its browser issue. Working fine with chrome, but not with firefox

0 Karma

somesoni2
Revered Legend

Can you try in IE?

0 Karma

skota524
Explorer

Its fine in IE. So issue with Mozilla

0 Karma

rjthibod
Champion

If what you are doing would work (which I am not sure it will) , you need to add the "condition" xml element.

<change>
    <condition label="*">
      <set token="time_selected">$label$</set>
    </condition>
</change>

The other thing to try is anywhere you have $time_selected$ in the dashboard, substitute it with $form.globalTime$. Still not confident it is possible, but are the only two things I can think of.

0 Karma

lguinn2
Legend

I am not sure that the realtime search times are supported in simple XML. Did you really want a realtime search in your dashboard?

0 Karma

skota524
Explorer

Yes. We need a live dashboard.

Real time search is working fine. But the only issue is label is not setting on load of dashboard.
Its working fine, when we change it.

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