Dashboards & Visualizations

condition is not working on input type="time"

arcotdeepika
Engager

created radio buttons and applied the condition, able to change value / label according selected value as condition,

But, when the same apply to time, it is not reflected in time values as earliest and latest.

check as below xml example.

Use tokens with conditional input choices

    <input type="radio" token="period_tok">
   <label>Select a time range</label>
        <choice value="-1d@d">1m</choice>
       <choice value="-5d@d">5m</choice>
  <default>Last 1Minute</default>

  <change>
    <condition label="1m">
            <set token="latestTime">-2d@d</set>
    </condition>
    <condition label="5m">
       <eval token="latestTime">relative_time($trxTime$,"+2d")</eval>
    </condition>
  </change>
</input>

 <input type="time"  searchWhenChanged="true" token="trxTime">
    <default>
           <earliest>-1d@d</earliest>
           <latest>now</latest>
     </default>  
           <earliest>$latestTime$</earliest>
           <latest>$latestTime</latest>


</input>

when I print $latestTime$ in dashboard it reflected value based on condition,but earliest and latest times in timepicker is not updating.

Can you please suggest here.

Thanks.

Tags (2)
0 Karma

sravankaripe
Communicator
<input type="radio" token="period_tok">
  <label>Select a time range</label>
  <choice value="-24h@h">Last 24 Hours</choice>
  <choice value="-7d@h">Last 7 Days</choice>
  <choice value="-30d@h">Last 30 Days</choice>
  <default>Last 24 Hours</default>

  <!-- set condition based on the label defined by <choice> -->
  <!-- Within each condition, specify a custom label for display -->
  <!-- Capture the selected value in the token, earliest_tok -->
  <change>
    <condition label="Last 24 Hours">
      <set token="date_label">Yesterday</set>
      <set token="earliest_tok">$value$</set>
    </condition>
    <condition label="Last 7 Days">
      <set token="date_label">Last week</set>
      <set token="earliest_tok">$value$</set>
    </condition>
    <condition label="Last 30 Days">
      <set token="date_label">Last month</set>
      <set token="earliest_tok">$value$</set>
    </condition>
  </change>
</input>
0 Karma

arcotdeepika
Engager

Thanks for response.

I tried the above, but its not solving my problem. with these code the token value indidually updating, but when I pass this value time, its not working. See the below code.

<label>Simple XML</label>
<description>A Simple Timerange with Conditional</description>
    <fieldset>
       <input type="radio" token="period_tok">
           <label>Select a time range</label>
           <choice value="-4d@h">1m</choice>
           <choice value="-14d@h">5m</choice>
           <choice value="-30d@h">15m</choice>
           <choice value="-90d@h">1h</choice>
           <default>Last 24 Hours</default>

           <!-- set condition based on the label defined by <choice> -->
           <!-- Within each condition, specify a custom label for display -->
           <!-- Capture the selected value in the token, earliest_tok -->
           <change>
             <condition label="1m">
               <set token="date_label">1minute</set>
               <set token="earliest_tok">$value$</set>
             </condition>
             <condition label="5m">
               <set token="date_label">5minutes</set>
               <set token="earliest_tok">$value$</set>
             </condition>
             <condition label="15m">
               <set token="date_label">15minutes</set>
               <set token="earliest_tok">$value$</set>
             </condition>
             <condition label="1h">
               <set token="date_label">1hour</set>
               <set token="earliest_tok">$value$</set>
             </condition>
         </change>
       </input>
      <input type="time">

            <earliest>$earliest_tok$</earliest>
            <latest>$earliest_tok$</latest>

      </input>


<row>
   <panel>

    <!-- Use tokens from the <input> elements in the panel title -->
    <title>
      Input selections: (radio):- "$period_tok$", $date_label$, (time):- "$earliest_tok$", $latest$
     </title> 
  </panel>

</row>
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...