Dashboards & Visualizations

How to change the default message "No results Found" in a panel?

dnv007
Explorer

I was able to change it through the developer tools feature in Chrome which is temporary. 

I wish to change the message  "No Results found"  to "Not Applicable" in all the panels; Same panel in the below screenshot:

dnv007_0-1621248322156.png

 

Achieved it through developer tools feature as below; But how do i make it permanent ?

dnv007_2-1621248452642.pngdnv007_3-1621248477661.png

Could someone please help on what lines of code am i to add in my source code so "Not Applicable" is displayed?

Thanks in advance!

Labels (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@dnv007 

I think below example will help you on this.  

XML:

<dashboard script="myJs.js">
  <label>Replace No Rec Found - &gt; Other Text</label>
  <search id="base">
    <query>| makeresults count=5 | eval a=1| accum a</query>
  </search>
  <row>
    <panel>
      <table id="t1">
        <search id="s1" base="base">
          <query>|where a="10"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t2">
        <search id="s2" base="base">
          <query>|where a="9"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t3">
        <search id="s3" base="base">
          <query>|where a="3"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t4">
        <search id="s4" base="base">
          <query>|where a="7"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t5">
        <search id="s5" base="base">
          <query>|where a="6"</query>
        </search>
      </table>
    </panel>
  </row>
</dashboard>

 

myJs.js

 

require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc) {

    $(document).ready(function() {
        // Panel wise tabe id and search id mappig
        var table_search_mapping = {
            "t1": "s1",
            "t2": "s2",
            "t3": "s3",
            "t4": "s4",
            "t5": "s5"
        };

        $.each(table_search_mapping, function(tableId, searchId) {
            var tmp = mvc.Components.get(searchId);
            tmp.on("search:done", function(properties) {
                if ($("#" + tableId + " .alert.alert-info")[0] !== undefined) {
                    console.log($("#" + tableId + " .alert.alert-info")[0].innerText)
                    if ($("#" + tableId + " .alert.alert-info")[0].innerText === "No results found.") {
                        $("#" + tableId + " .alert.alert-info")[0].innerText = "KV ▄︻̷̿┻̿═━一 ";
                    }
                }
            });
        });
    });
});

 

Feel free to ask anything in case.

 

Thanks
KV
▄︻̷̿┻̿═━一

If this reply helps you, an upvote would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@dnv007 

I think below example will help you on this.  

XML:

<dashboard script="myJs.js">
  <label>Replace No Rec Found - &gt; Other Text</label>
  <search id="base">
    <query>| makeresults count=5 | eval a=1| accum a</query>
  </search>
  <row>
    <panel>
      <table id="t1">
        <search id="s1" base="base">
          <query>|where a="10"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t2">
        <search id="s2" base="base">
          <query>|where a="9"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t3">
        <search id="s3" base="base">
          <query>|where a="3"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t4">
        <search id="s4" base="base">
          <query>|where a="7"</query>
        </search>
      </table>
    </panel>
    <panel>
      <table id="t5">
        <search id="s5" base="base">
          <query>|where a="6"</query>
        </search>
      </table>
    </panel>
  </row>
</dashboard>

 

myJs.js

 

require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc) {

    $(document).ready(function() {
        // Panel wise tabe id and search id mappig
        var table_search_mapping = {
            "t1": "s1",
            "t2": "s2",
            "t3": "s3",
            "t4": "s4",
            "t5": "s5"
        };

        $.each(table_search_mapping, function(tableId, searchId) {
            var tmp = mvc.Components.get(searchId);
            tmp.on("search:done", function(properties) {
                if ($("#" + tableId + " .alert.alert-info")[0] !== undefined) {
                    console.log($("#" + tableId + " .alert.alert-info")[0].innerText)
                    if ($("#" + tableId + " .alert.alert-info")[0].innerText === "No results found.") {
                        $("#" + tableId + " .alert.alert-info")[0].innerText = "KV ▄︻̷̿┻̿═━一 ";
                    }
                }
            });
        });
    });
});

 

Feel free to ask anything in case.

 

Thanks
KV
▄︻̷̿┻̿═━一

If this reply helps you, an upvote would be appreciated.

dnv007
Explorer

Hi kamlesh_vaghela!

Thanks for this! 

 

Do i just add it with the rest of the XML code i already have for the dashboard and place the js in the backend?

 

Sorry new to this!

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@dnv007 

 

Create myJs.js javascript in SPLUNK_HOME/etc/apps/YOUR_APP/appserver/static/  folder. 

 

Thanks
KV
▄︻̷̿┻̿═━一

If this reply helps you, an upvote would be appreciated.

0 Karma

dnv007
Explorer

Hi KV,

I added the script to my env, but my searches do not include a search id, base search or a table id which i understand is vital in order for the script to work(Please correct me if i am wrong).

Is there a workaround? 

Thanks again in advance!

0 Karma

dnv007
Explorer

Can we also just make do by assigning search id's alone?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...