All Apps and Add-ons

Pulldown Multi-select multiple templates?

jamesvz84
Communicator

With SideView Utils, I am using multi-selection Pulldown. Upon multi-selection, I would like to create two templates. One for use in a query (Ex: application=app1 OR application=app2) and one for use in a drilldown URL to pass the values to the target page (Ex: application=app1&application=app2). Is there any way I can create two template on a Pulldown. Or is there some other way to accomplish my goal?

0 Karma

sideview
SplunkTrust
SplunkTrust

1) If the second use of the pulldown arguments is for a URL, 90% of the time you should use the Sideview Redirector module as it handles it for you automatically, at least if you're on a comparatively recent Sideview Utils (latest is 3.2.5 and if you're still on 2.x or 1.x the first thing you should do is upgrade -- http://sideviewapps.com/apps/sideview-utils )

Redirector will handle all the character escaping, and the multiple arguments, and everything just fine - just have <param name="arg.yourTokenHere">$yourToken.rawValue$</param> and you're done.

But.... if you're in the small subset of weird cases where you do need to manually create a URL,

2) you could use the Pulldown's template + separator + outerTemplate params for the main one, and you would use an ArrayValueSetter module for the other one.


foo
Foo
4
foo="$value$"
+OR+
( $value$ )

foofield

  <module name="ArrayValueSetter">
    <param name="name">foo_url</param>
    <param name="array">$foo.rawValue$</param>
    <param name="template">foo=$value$</param>
    <param name="separator">&amp;</param>
    <param name="outerTemplate"></param>

However.... The ArrayValueSetter isn't really designed to make URL's - it's designed to marshal array-valued tokens into things for the search language. As such you may run into problems with url-unsafe chars not being escaped, or with chars being backslash-escaped (for the search language) when you dont want them backslash-escaped. So think very carefully about why you're not using the Redirector module... Email support@sideviewapps.com with your XML if you need advice.

3) somesoni2 gives a fun answer - in the form of using ResultsValueSetter and the search language to craft your correctly-escaped URL up in the search language and then "pull it down" with ResultsValueSetter so it can become a $foo$ token in the UI. This is an extremely powerful and advanced technique, and if it's your cup of tea it's a very tool to heep in your back pocket. 😃 However I strongly recommend thinking about your use case and trying to let the Redirector module do all the work for you. Remember that Link and Redirector or Button + Redirector can be combined very easily...

EXTRA:

A) For others interested in ArrayValueSetter and the general idea of using the array valkues from a multiple selection Pulldown or CheckboxPulldown, or Checkboxes modules, in more than one way, there is of course a whole docs page dedicated to the ArrayValueSetter module, with working examples. In additoin there is a hidden page in Sideview Utils called "testcases_for_array_value_setter" which would give you a few more working examples to play with.

B) I consider the multiple selection mode on the Pulldown module to be obsolete, and you should consider using the CheckboxPulldown module instead.... It offers better usability and at the same time a more compact form element.

0 Karma

somesoni2
Revered Legend

You can use combination of "Search" and "ResultValueSetter" modules to modify the value for drilldown. Something like this

<module name="Search" layoutPanel="panel_row3_col1" group="...">
    <param name="search">....some search with OR condition application=app1 OR application=app2</param> 
        <module name="HiddenChartFormatter">
            <param name="charting.secondaryAxisTitle.text">Count</param> 
            <param name="charting.chart">column</param> 
            <module name="FlashChart">
                <param name="width">100%</param> 
                <module name="Search">
                    <param name="search">...Your custom search to build localTokenName like "application=app1&application=app2"</param>                 
                    <module name="ResultsValueSetter">
                        <param name="fields">localTokenName</param> 
                        <module name="Redirector">
                            <param name="url">yourTargetdashboard</param> 
                            <param name="arg.TokenNameAtTarget">$localTokenName$</param>
                        </module>
                        .
                        .
                        .
                        .
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...