Dashboards & Visualizations

dealing with space on a tokenized value in a form dashboard using dropdown

mjones414
Contributor

I've a form thats tokenizing about 13 different fields, and the values are a mixmatch of single and multiple word entries. In text, I can simply add a suffix of * and the person can type some of the value and find what they want, but in a dropdown (desired), this will only work if the value contains no spaces at all. I've tried seeding with "*" as typed, but that didn't seem to make a difference. How can I successfully pass a multi-word value into a token from a dropdown and have it filter a table in a form bases dashboard

dfoster_splunk
Splunk Employee
Splunk Employee

When passing the value from the dropdown to the search, use the "s" filter to escape the dropdown value for search. This will allow you to search for phrases containing multiple words.

So if DropdownView.value is mvc.tokenSafe("$words$"), set SearchManager.search to something like mvc.tokenSafe("search $words|s$").

sg_content
Engager

this worked for me! Thank you

0 Karma

srtarak09
Engager

It worked for me. Thanks.

0 Karma

dfoster_splunk
Splunk Employee
Splunk Employee

Not quite. The |s suffix is a filter that is applied to the output. So if the token was being used in a search string (like ) then you'd have $MyToken|s$. But the input that generates the token in the first place would still be token="MyToken".

0 Karma

mjones414
Contributor

So would the right approach then to be to put token="MyToken|s" in the input type to keep everything in simple xml, or don't define token= and explicitly define mvc.tokenSafe("MyToken|s")

0 Karma

dfoster_splunk
Splunk Employee
Splunk Employee

mvc.tokenSafe() is applied automatically to most settings in Simple XML. For example binds the created DropdownView.value to mvc.tokenSafe("$MyToken$").

And the contents of are also wrapped with mvc.tokenSafe().

None of this is Advanced XML. The explicit use of mvc.tokenSafe() comes into play when using either HTML dashboards or custom JS code.

0 Karma

mjones414
Contributor

So in my case I am using a simple XML form.

I'm taking something like



""

| inputlookup inventory.csv | fields MyTokenField
"*"

Then feeding that into a table with a token from above. Where does mvc.tokenSafe fit and does that make it advanced XML?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...