All Apps and Add-ons

URL loader in sideview

smolcj
Builder

hi ,
i am trying to use the URLLoader module for the backward and forward use in my view.
i have a drop down box and i dont want the value in the drop down box to be changed when i am back from a drill down. how to do this . i tried it with sideview util, but when i am doing a drilldown the value in the dropdown box is refreshed. is there any way to overcome this.
please help
thank you

1 Solution

sideview
SplunkTrust
SplunkTrust

OK. Thanks for sending your code.

URLLoader works with the Sideview modules, for example Pulldown and TextField and Checkbox, as well as with some of the core Splunk modules like TimeRangePicker and SearchBar, and it can preserve the state of all these modules when they are present downstream.

However it doesn't work with all modules. In your view, you're trying to get URLLoader to preserve the state of SearchSelectLister, but this isn't supported. The Sideview Pulldown module was introduced long ago to replace SearchSelectLister though, and you can just replace SearchSelectLister with Pulldown and this will work.

The better news is that replacing Pulldown with SearchSelectLister will also make your page a lot simpler.

for example, this code with SearchSelectLister,

<module name="SearchSelectLister" layoutPanel="viewHeader">
  <param name="searchWhenChanged">False</param>
  <param name="label">Select Your Source</param>
  <param name="settingToCreate">sources_setting</param>
  <param name="staticFieldsToDisplay">
    <list>
      <param name="label">Select Your Session Log File From the Given Options</param>
    </list>
  </param>
  <param name="search">
   index=main sourcetype=pc_log |top source|rex mode=sed field=source  "s/\\\{1}/\\\\\//g" |rex mode=sed field=source  "s/\///g" |fields source
  </param>
  <param name="searchFieldsToDisplay">
    <list>
      <param name="value">source</param>
      <param name="label">source</param>
    </list>
  </param>
  <module name="ConvertToIntention">
    <param name="settingToConvert">sources_setting</param>
    <param name="intention">
      <param name="name">stringreplace</param>
      <param name="arg">
        <param name="sources">
          <param name="fillOnEmpty">True</param>
          <param name="value">$target$</param>
        </param>
      </param>
    </param>

Can be replaced by this:

<module name="Search">
  <param name="search">
    index=main sourcetype=pc_log |top source|rex mode=sed field=source  "s/\\\{1}/\\\\\//g" |rex mode=sed field=source  "s/\///g" |fields source
  </param>
  <module name="Pulldown" layoutPanel="viewHeader">
    <param name="name">source</param>
    <param name="label">Select Your Source</param>
    <param name="valueField">source</param>
    <param name="staticOptions">
      <list>
        <param name="label">Select Your Session Log File From the Given Options</param>
        <param name="value"></param>
      </list>
    </param>

Of course, you'd have to also replace all the HiddenSearch modules with Sideview's Search module. There's a lot of documentation about this though, and you don't have to immediately convert to using all of it.

View solution in original post

sideview
SplunkTrust
SplunkTrust

I think what you're seeing is the similar but arguably more limited linking ability that Splunk put into the Simple XML in 5.0. The stuff you see in the url's there will look superficially similar to the Sideview conventions around URLLoader but they work a bit differently.

smolcj
Builder

hi,
when i went through splunk dashboard examples(for 5.x), i found in the view


/app/dashboard_examples/form_dropdown/
URL loader is working finely, even the dashboard is in simple xml.
how is it done? i didnt get any clue from the dashboard source. please help if somebody knows/ shall i post it as a different question.

0 Karma

sideview
SplunkTrust
SplunkTrust

OK. Thanks for sending your code.

URLLoader works with the Sideview modules, for example Pulldown and TextField and Checkbox, as well as with some of the core Splunk modules like TimeRangePicker and SearchBar, and it can preserve the state of all these modules when they are present downstream.

However it doesn't work with all modules. In your view, you're trying to get URLLoader to preserve the state of SearchSelectLister, but this isn't supported. The Sideview Pulldown module was introduced long ago to replace SearchSelectLister though, and you can just replace SearchSelectLister with Pulldown and this will work.

The better news is that replacing Pulldown with SearchSelectLister will also make your page a lot simpler.

for example, this code with SearchSelectLister,

<module name="SearchSelectLister" layoutPanel="viewHeader">
  <param name="searchWhenChanged">False</param>
  <param name="label">Select Your Source</param>
  <param name="settingToCreate">sources_setting</param>
  <param name="staticFieldsToDisplay">
    <list>
      <param name="label">Select Your Session Log File From the Given Options</param>
    </list>
  </param>
  <param name="search">
   index=main sourcetype=pc_log |top source|rex mode=sed field=source  "s/\\\{1}/\\\\\//g" |rex mode=sed field=source  "s/\///g" |fields source
  </param>
  <param name="searchFieldsToDisplay">
    <list>
      <param name="value">source</param>
      <param name="label">source</param>
    </list>
  </param>
  <module name="ConvertToIntention">
    <param name="settingToConvert">sources_setting</param>
    <param name="intention">
      <param name="name">stringreplace</param>
      <param name="arg">
        <param name="sources">
          <param name="fillOnEmpty">True</param>
          <param name="value">$target$</param>
        </param>
      </param>
    </param>

Can be replaced by this:

<module name="Search">
  <param name="search">
    index=main sourcetype=pc_log |top source|rex mode=sed field=source  "s/\\\{1}/\\\\\//g" |rex mode=sed field=source  "s/\///g" |fields source
  </param>
  <module name="Pulldown" layoutPanel="viewHeader">
    <param name="name">source</param>
    <param name="label">Select Your Source</param>
    <param name="valueField">source</param>
    <param name="staticOptions">
      <list>
        <param name="label">Select Your Session Log File From the Given Options</param>
        <param name="value"></param>
      </list>
    </param>

Of course, you'd have to also replace all the HiddenSearch modules with Sideview's Search module. There's a lot of documentation about this though, and you don't have to immediately convert to using all of it.

sideview
SplunkTrust
SplunkTrust

If others are just getting started with the Pulldown module instead of SearchSelectLister+ConvertToIntention, there is a screencast up talking about precisely this topic. What the Pulldown module is, how it works, why it's so much better than SearchSelectLister and ConvertToIntention. http://www.youtube.com/watch?v=fkXBgkwZoEQ

0 Karma

sideview
SplunkTrust
SplunkTrust

You should go back and read all the documentation in the Sideview Utils app. The pages are all organized into a tutorial and at the same time an extensive reference. Indeed you wont need ConvertToIntention anymore. And if the Pulldown is not showing any dynamic results, it probably means that the search feeding it returns no results. The easy way to debug is to throw an HTML module in there, have it display "$search$" in it's "html" param, and that will write out the current search at that point. If you dont see anything that would make it return 0 results, run it manually to check.

smolcj
Builder

Also, whatever i select, the pulldown box is showing only the default(Static option). i am not able to select anything.
please help

0 Karma

smolcj
Builder

So there is no need of using ConvertToIntention in the code? i am not that much aware of ConvertToIntention. can u help me with a good document that can help me.

0 Karma

smolcj
Builder

i just mailed u my code . please look into it and help

0 Karma

sideview
SplunkTrust
SplunkTrust

And the Pulldown module is nested downstream from URLLoader? Can you post your XML or put it on pastebin?

0 Karma

smolcj
Builder

i am doing so

True
added these lines right after the Message module

0 Karma

sideview
SplunkTrust
SplunkTrust

And you're using the "keepUrlUpdated" param of URLLoader? You have to set it to true for it to keep track of all the changes of UI elements, and thus for the back button to work when you go back from a drilldown. Note that by default keepUrlUpdated is false so you have to set it to true when you want the fancy behavior.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...