Dashboards & Visualizations

How to save chosen by user filters values?

ASHYPKOV
New Member

Hello experts,

is there any way how to save chosen filter value?
Requirement is that when user opens dashboard next time then previously chosen filters valus should be set by default

Thanks in advance

Tags (1)
0 Karma

Rocket66
Communicator

I think, the best would be to write a Javascript with handling of session coockies ...

-> http://www.w3schools.com/js/js_cookies.asp

If you use simple XML, you can write a javascript extension and load that into your dashboard.

If you are using Splunk 6, insert the schtip into the dashboard, form, ... - tag :

<dashboard script="myscript.js>"

or in Splunk 5, put it into the "application.js"

0 Karma

Rocket66
Communicator

Or if using tokens (for the input(s)), you can manipulate the token-model, which is easier to handle and use for other purposes (eg. drilldowns)

0 Karma

Rocket66
Communicator

Well, this ain't easy to answer ... without knowing your dashboard(s) and your "filter values" (where they come from - which object? Do you use (a) input field(s) or dropdown, radio, ...?)

In Simple XML it's very hard to get control of objects and the code.

You have to investigate, which id's in the code are used for that object.

E.g.: if you use (only) one (or the first) input field in that dashboard, the id would be "field1". So you can access that via JQuery and set the cookies depending on that (changed) value - done with an event handler. And get the cookie and set the input value.

0 Karma

ASHYPKOV
New Member

Thank you a lot for the helful answer.
But now for me there one question related:
Let's suppose that I have stand-alone coockies.js fiel with necessary JS functuions: writing, reading and so forth.
What should I write in Xml - advance and simple versions - to call f.e. method "getCookie("userFilters")"?

I haven't managed to find an answer.

0 Karma

ASHYPKOV
New Member

Thank you for the idea.
Now I am thinking over using of lookup tables that I can populate dynamically

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...