Quantcast
Channel: Questions in topic: "splunk-enterprise"
Viewing all articles
Browse latest Browse all 47296

Listen in on search manager called two times

$
0
0
Hi, I want to delete an entry from KV-Store, and for that I have defined a search manager and on the dashboard I have a button called "delete". By clicking on the button I call the startSearch function to trigger the search. The problem which I have that the listener on the search called twice. I have tried to use hasData() method but did not success . I'll appreciate if you hve any suggestions! `var deletesearch = new SearchManager({ "id": "deletesearch", "sample_ratio": null, "autostart": false, "search": delquery, "cancelOnUnload": true, "status_buckets": 0, "app": utils.getCurrentApp(), "auto_cancel": 90, "preview": false, "runWhenTimeIsUndefined": false }, { tokens: true }); $('#deleteAlert').on('click', function() { delandsav = false; deletesearch.startSearch(); }); var resultsArray = []; var deleteresults = deletesearch.data("results"); deleteresults.on("data", function() { // If we're not in the first run of on("data", ...), stop if (!deleteresults.hasData()) { return; } resultsArray = deleteresults.data().rows; deleteKVEntry(kvcollection, alertKey); for (var i = 0; i < resultsArray.length; i++) { submitKVRecord(kvcollection, createKVRecord(alertprefix + resultsArray[i][0], defaultTokens.get(resultsArray[i][0]), defaultTokens.get(form + resultsArray[i][0])), overwrite); } `

Viewing all articles
Browse latest Browse all 47296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>