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
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...