Dashboards & Visualizations

How to get all results from multi page search results table?

splunkhmcv
Loves-to-Learn

Hi!

I have a dashboard that has search input fields that allow to run a search and the results are displayed on the table. 

I want to create a custom button to act on the data from the search. I don't want to repeat the search using tokens and searchmanager.

Is it possible to load the full results from the table on javascript in the case of a multi page table like this :

splunkhmcv_0-1654185936540.png

I know it's possible to download a .csv file using the SID from the search but I want to know if there is other way to do it.

 

I can extract the data from the table page that's currently rendered on the dashboard.

 

Thank you in advance.

Labels (5)
0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@splunkhmcv - You can do it with the search id.

Assign id to search in XML, like

<table>
  <search id="my_search">
    <query>....

 

And you can read the same results in the JS like:

// Imports
require([
        'splunkjs/mvc', 
...


// read the same search results
let mySearchManager = mvc.Components.get("my_search");
let myResults = mySearchManager.data("results");
        myResults.on("data", function () {
            resultArray = myResults.data().rows;
            $.each(resultArray, function (index, value) {
                console.log(value);
            });
        });

 

I hope this helps!!!

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...