HI All;
I have and issue dealing with a dynamic prompt:
Here's my code below:
<form refresh="9999999360">
<label>Venue F&B Dashboard</label>
<fieldset submitButton="false">
<input type="dropdown" token="date" searchWhenChanged="true">
<label>Select a Date:</label>
<search>
<query>|inputlookup lookup_mobile_events_metadata.csv |stats count| eval time="Today"|eval row=0|append[| `macro_Ndays_timepickernew(10)`| streamstats count as row|eval row=row*(-1)]|eval next_day=row+1</query>
<earliest>-24h</earliest>
<latest>now</latest>
</search>
<fieldForLabel>time</fieldForLabel>
<fieldForValue>row</fieldForValue>
<default>0</default>
<change>
<set token="date_after">$row.next_day$</set>
</change>
</input>
<input type="dropdown" token="earliest_timestamp" searchWhenChanged="true">
<label>From:</label>
<search>
<query>| `Macro_To_and_From_Timepicker_To($date$,$date_after$,starttime)`</query>
<earliest>0</earliest>
</search>
<fieldForLabel>starthuman</fieldForLabel>
<fieldForValue>starttime</fieldForValue>
<selectFirstChoice>true</selectFirstChoice>
</input>
<input type="dropdown" token="latest_timestamp" searchWhenChanged="true">
<label>To:</label>
<search>
<query>| `Macro_To_and_From_Timepicker_To($date$,$date_after$,endtime)`</query>
<earliest>0</earliest>
</search>
<fieldForLabel>endhuman</fieldForLabel>
<fieldForValue>endtime</fieldForValue>
<selectFirstChoice>true</selectFirstChoice>
where macro definitions are below:
[macro_Ndays_timepicker(1)]
args = days
definition = gentimes start=-$days$ end=0|eval time=strftime(starttime,"%Y %B %d")|sort - starttime|rename starttime as dateadded_epoch
iseval = 0
[Macro_To_and_From_Timepicker_To(3)]
args = start,end,startorendtime
definition = gentimes start=$start$ end=$end$ increment=30m| sort + starttime|eval display_time=strftime($startorendtime$,"%H:%M")
iseval = 0
here's pics of the issue:
The prompts appear all fine for today June 19th,
But when I change from the 19th to the 16th in the first prompt, the next 2 prompts don't update the chosen value and instead keep the selected Epoch timestamp they had for the 19th. Although as you can see, in the back end the choices did change, so the user would then just have to select an appropriate time for the selected date.
Any suggestions?
Thanks,
Tyler
Hi All;
Just an update on this:
To accomplish this goal, my team worked with splunk support and solved this by following these steps, which basically involve a logic to unset the token for the next two prompts right after the first prompt's token is set. Below is the fix for just the "From" time-prompt :
1.) open the original deep.xml code
2.) in the xml, change:
<input type="dropdown" token="fromtime" searchWhenChanged="false">
to
<input type="dropdown" token="fromtime" searchWhenChanged="true">
3.) Save and convert the dashboard to HTML dashboard which would give you a following source: see attached deep.html
4.) In the HTML source, go to the following piece of code (lines: 296 - 300):
input1.on("valueChange", function(e) {
if (e.value !== undefined) {
EventHandler.unsetToken("form.fromtime");
}
});
And change it to look something like this:
input1.on("valueChange", function(e) {
if (e.value !== undefined) {
if(urlTokenModel.get("form.fromtime") && !submittedTokenModel.get("form.fromtime")) {
return;
}
EventHandler.unsetToken("form.fromtime");
}
});
5.) Now save and open the dashboard.
Hi All;
Just an update on this:
To accomplish this goal, my team worked with splunk support and solved this by following these steps, which basically involve a logic to unset the token for the next two prompts right after the first prompt's token is set. Below is the fix for just the "From" time-prompt :
1.) open the original deep.xml code
2.) in the xml, change:
<input type="dropdown" token="fromtime" searchWhenChanged="false">
to
<input type="dropdown" token="fromtime" searchWhenChanged="true">
3.) Save and convert the dashboard to HTML dashboard which would give you a following source: see attached deep.html
4.) In the HTML source, go to the following piece of code (lines: 296 - 300):
input1.on("valueChange", function(e) {
if (e.value !== undefined) {
EventHandler.unsetToken("form.fromtime");
}
});
And change it to look something like this:
input1.on("valueChange", function(e) {
if (e.value !== undefined) {
if(urlTokenModel.get("form.fromtime") && !submittedTokenModel.get("form.fromtime")) {
return;
}
EventHandler.unsetToken("form.fromtime");
}
});
5.) Now save and open the dashboard.
I believe this does no longer apply to the newest version of Splunk.
What happened when you upgraded?
Is it resolved now? we are using 6.3.2 and still facing the same problem