I have a Time selector. Each time it's clicked, a certain set of tokens must always recalculate, including one which determines the span of time in between earliest and latest.
I have 2 panels. ...
See more...
I have a Time selector. Each time it's clicked, a certain set of tokens must always recalculate, including one which determines the span of time in between earliest and latest.
I have 2 panels. Only 1 panel must be shown at a time, depending on how long the span is between earliest and latest. Within 1 day, show the "comparison" panel, longer than 1 day, show the "single" panel
The xml below always sets both tokens, "showPanelSingle" and "showPanelComparison", but I can only have 1 set at a time.
<input type="time" token="time" searchWhenChanged="false">
<label>Time Frame</label>
<default>
<earliest>-1d@d</earliest>
<latest>@d</latest>
</default>
<change>
<eval token="time.earliest_epoch">if(isnum('earliest'),'earliest',relative_time(now(),'earliest'))</eval>
<eval token="time.latest_epoch">if(isnum('latest'),'latest',relative_time(now(),'latest'))</eval>
<eval token="time_difference">$time.latest_epoch$-$time.earliest_epoch$</eval>
<eval token="form.span">if($time_difference$>2592000,"1d",if($time_difference$>86400,"1h","1m"))</eval>
<eval token="showPanel">if($time_difference$>86400,"Comparison","Single")</eval>
<eval token="showPanelSingle">if($showPanel$="Single","true","")</eval>
<eval token="showPanelComparison">if($showPanel$="Comparison","true","")</eval>
</change>
</input>
The xml below never sets either token, even after selecting the Time.
<form theme="dark">
<label></label>
<init>
<condition match="$showPanel$, "Single"">
<eval token="showPanelSingle">true</eval>
</condition>
<condition match="$showPanel$, "Comparison"">
<eval token="showPanelComparison">true</eval>
</condition>
</init>
Note, the Time calculations must always run, so I can't add them to a condition, but I need condition on the rest, and Splunk doesn't allow this hybrid approach, nor is it allowed to qualify multiple condition tags.
How can I accomplish where 1 and only 1 of them is set (and the correct one) upon clicking "Submit" in the input filters.