<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to run query after javascript on initial load in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-run-query-after-javascript-on-initial-load/m-p/689249#M56463</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/251652"&gt;@verothor&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    "splunkjs/mvc/searchmanager",
    'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, SearchManager) {

    let mySearch = new SearchManager({
        id: "mysearch",
        autostart: "false",
        search: '| makeresults | eval test = "This is test" ',
        preview: false,
    }, { tokens: true, tokenNamespace: "submitted" });

    let mySearchResults = mySearch.data("results");
    mySearchResults.on("data", function () {
        resultArray = mySearchResults.data().rows;
        console.log("My Data", resultArray);
    });

    $(document).ready(function () {
        setInterval(function () {
            mySearch.startSearch();
        }, 3000);
    });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: This is a sample JS. Just modify as per your requirement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 16:42:34 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2024-05-31T16:42:34Z</dc:date>
    <item>
      <title>How to run query after javascript on initial load</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-run-query-after-javascript-on-initial-load/m-p/678817#M55599</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I am trying to set up a code in javascript which will refresh page after javascript run,&lt;/P&gt;&lt;P&gt;because now my dashboards loads, but javascript run first and the visualizations depends on javascript and then coloring for example don't change.&lt;/P&gt;&lt;P&gt;When I tried to put refresh under query to 5seconds, then it was reloaded and all visualizations were loaded, but I would like to do it better way and I am sure with javascript is possible, but I am very basic with javascript, so I was searching here, but nothing worked, because mainly it was set up, that after some button click the javascript will reload the page, but I would like to have it automatically.&lt;/P&gt;&lt;P&gt;Thank you for any ideas.&lt;/P&gt;&lt;P&gt;v.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 12:27:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-run-query-after-javascript-on-initial-load/m-p/678817#M55599</guid>
      <dc:creator>verothor</dc:creator>
      <dc:date>2024-02-27T12:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to run query after javascript on initial load</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-run-query-after-javascript-on-initial-load/m-p/689249#M56463</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/251652"&gt;@verothor&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you tried something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    "splunkjs/mvc/searchmanager",
    'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, SearchManager) {

    let mySearch = new SearchManager({
        id: "mysearch",
        autostart: "false",
        search: '| makeresults | eval test = "This is test" ',
        preview: false,
    }, { tokens: true, tokenNamespace: "submitted" });

    let mySearchResults = mySearch.data("results");
    mySearchResults.on("data", function () {
        resultArray = mySearchResults.data().rows;
        console.log("My Data", resultArray);
    });

    $(document).ready(function () {
        setInterval(function () {
            mySearch.startSearch();
        }, 3000);
    });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: This is a sample JS. Just modify as per your requirement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 16:42:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-run-query-after-javascript-on-initial-load/m-p/689249#M56463</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2024-05-31T16:42:34Z</dc:date>
    </item>
  </channel>
</rss>

