I have two dashboard with each having a dynamic drop-down. The drop down is populating the data using the search like below.
<input type="dropdown" token="name" searchWhenChanged="true"> <label>User</label> <selectFirstChoice>true</selectFirstChoice> <search> <query>index=myindex | fields user | dedup user | SORT user</query> </search> <fieldForLabel>user</fieldForLabel> <fieldForValue>user</fieldForValue> </input>
so now by default first choice is selected as default.
But if user selects other User name in first dashboard, then in the second dashboard while populating the drop-down list, default should be the choice of what was selected in first dashboard.
I dont want convert the page into html. I am clueless.
How to achieve this? any suggestions will be useful.
Assuming that you're navigating to second dashboard from first and that's when you want selected user from first dashboard to be available in second dashboard (and selected), then what you need is the dynamic drilldown by passing the user token from first dashboard to second. See this for more info
Basically, Add this to first dashboard's panel from where you want to navigate to second dashboard. Hope the dropdown token name is same in second dashboard.
<panel> ..... <drilldown target="My New Window"> <link> second_dashboard_name?form.name=$name$ </link> </drilldown> ... </panel>
I am not navigating to second dashboard from First. This is like menu mentioned in nav/default.xml.
First dashboard is like home page. Whatever user chooses in home page from drop-down menu, that value should be focused/selected in the second dashboard's drop down list.
hope i am clear in explaining the issue. I am new to xml/splunk. Most solutions i got around was using token in same dashboard or passing token using CDATA in drill down. But scenario having is different from them. Pls suggest.
Than you want the logged on user as the drilldown value. If you can use the
rest generating command, than a simple search will give you username of the current user. That search is
| rest /services/authentication/current-context/context | table username. You would update your input element to the following:
<input type="dropdown" token="name" searchWhenChanged="true"> <label>User</label> <selectFirstChoice>true</selectFirstChoice> <search> <query>| rest /services/authentication/current-context/context | table username | rename username as user</query> </search> <fieldForLabel>user</fieldForLabel> <fieldForValue>user</fieldForValue> </input>
I think one of us is confused.
The search I provided will list the current user that is on the dashboard. So, the user that selected the dashboard from the navigation drop-down menu will be the one that appears in the dropdown input.
If this is not what you want, please try to reclarify what you are looking for.
Lets assume, the drop-down menu, has list of devices. the list of devices is coming from the app indexed data.
Assume there are 3 devices, the drop down contains like a, b, c, now device "a" is selected by default in page 1. And app user selects device "b" from drop down menu in page 1, all the panels below will get refreshed with b's data.
Now app user will go page 2, it also has same drop-down menu, with same search to populate the list of devices present. It populates devices a, b, c, with a as selected by default.
My requirement is in page 2, the drop-down menu should focus on device "b" instead of "a", since in page 1 user selected "a". how to remember which device is selected in page 1, and display same in page 2 's drop-down as selected, like b, a, c . does this clarifies the doubt?
In SimpleXML, you can only pass tokens to another dashboard via SimpleXML.
You have to get the user to click on something in page 1 that will link them to page 2, and that link URL will contain the token values you are trying to pass between pages.
See this link as a reference.