<?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: Java script to  have return with  wildcards in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564331#M46409</link>
    <description>&lt;P&gt;Hi&amp;nbsp; Thanks a lot for your patience . But&amp;nbsp; i&amp;nbsp; get&amp;nbsp; the&amp;nbsp; belwo&amp;nbsp; error when ever&amp;nbsp; i&amp;nbsp; check&amp;nbsp; the developer tools.&lt;/P&gt;&lt;P&gt;"is not defined&lt;BR /&gt;at child.canRender "&lt;/P&gt;</description>
    <pubDate>Mon, 23 Aug 2021 13:18:41 GMT</pubDate>
    <dc:creator>Rukmani_Splunk</dc:creator>
    <dc:date>2021-08-23T13:18:41Z</dc:date>
    <item>
      <title>Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/563926#M46390</link>
      <description>&lt;P&gt;Hi I am using java script to change teh column value color in splunk …&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; CustomRangeRenderer = TableView.BaseCellRenderer.extend({
          &lt;SPAN class="hljs-attr"&gt;canRender&lt;/SPAN&gt;: &lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;function&lt;/SPAN&gt; (&lt;SPAN class="hljs-params"&gt;cell&lt;/SPAN&gt;) &lt;/SPAN&gt;{
              &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; _(&lt;SPAN class="hljs-string"&gt;'source'&lt;/SPAN&gt;).contains(cell.field);
          },&lt;/PRE&gt;&lt;P&gt;i want this with wildcard like this column to have any value before&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; CustomRangeRenderer = TableView.BaseCellRenderer.extend({
          &lt;SPAN class="hljs-attr"&gt;canRender&lt;/SPAN&gt;: &lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;function&lt;/SPAN&gt; (&lt;SPAN class="hljs-params"&gt;cell&lt;/SPAN&gt;) &lt;/SPAN&gt;{
              &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; _(&lt;SPAN class="hljs-string"&gt;'*source'&lt;/SPAN&gt;).contains(cell.field);
          },&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Aug 2021 10:00:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/563926#M46390</guid>
      <dc:creator>Rukmani_Splunk</dc:creator>
      <dc:date>2021-08-19T10:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564079#M46398</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207122"&gt;@Rukmani_Splunk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;canRender: function(cell) {
            var _lst = cell.field.match('.*source') // Provide your matching criteria
            var _other_lst = ['A', 'Version', 'Version_A'] // In case you have additional Column List
            var list = $.merge(_lst ? _lst : [], _other_lst)
            return _(list).contains(cell.field);
        },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;KV&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 11:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564079#M46398</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-08-20T11:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564130#M46399</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Thanks for your response .. But&amp;nbsp; it&amp;nbsp; has not&amp;nbsp; worked for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My&amp;nbsp; table is like&lt;/P&gt;&lt;P&gt;sourcetype&amp;nbsp; &amp;nbsp; &amp;nbsp; source&amp;nbsp; &amp;nbsp; time::count&amp;nbsp;&lt;/P&gt;&lt;P&gt;web file&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;access&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my&amp;nbsp; &amp;nbsp;dashboard is like&amp;nbsp;&lt;/P&gt;&lt;P&gt;dashboard script="table_high2.js" stylesheet="test.css"&amp;gt;&lt;BR /&gt;&amp;lt;label&amp;gt;test1&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;.css_for_green{&lt;BR /&gt;background-color:#65A637 !important;&lt;BR /&gt;}&lt;BR /&gt;.css_for_yellow{&lt;BR /&gt;background-color:#FFFF00 !important;&lt;BR /&gt;}&lt;BR /&gt;.css_for_red{&lt;BR /&gt;background-color:#FF0000 !important;&lt;BR /&gt;}&lt;BR /&gt;.css_for_grey{&lt;BR /&gt;background-color:#EEE000 !important;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;BR /&gt;&amp;lt;table id="tableWithColorBasedOnAnotherField"&amp;gt;&lt;BR /&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;index=_internal |stats count by sourcetype,source | rename count as "time::count" &amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;row&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Java script&amp;nbsp; based on your input&amp;nbsp;&lt;/P&gt;&lt;P&gt;require([&lt;BR /&gt;'underscore',&lt;BR /&gt;'jquery',&lt;BR /&gt;'splunkjs/mvc',&lt;BR /&gt;'splunkjs/mvc/tableview',&lt;BR /&gt;'splunkjs/mvc/simplexml/ready!'&lt;BR /&gt;], function (_, $, mvc, TableView) {&lt;BR /&gt;&lt;BR /&gt;var CustomRangeRenderer = TableView.BaseCellRenderer.extend({&lt;BR /&gt;canRender: function(cell) {&lt;BR /&gt;var list = cell.field.match('*count') // Provide your matching criteria&lt;BR /&gt;&lt;BR /&gt;return _(list).contains(cell.field);&lt;BR /&gt;},&lt;BR /&gt;&lt;BR /&gt;render: function ($td, cell) {&lt;BR /&gt;&lt;BR /&gt;var val = cell.value;&lt;BR /&gt;&lt;BR /&gt;if (val &amp;lt; 5) {&lt;BR /&gt;$td.addClass("range-cell").addClass("css_for_green")&lt;BR /&gt;}&lt;BR /&gt;else if (val &amp;lt;10) {&lt;BR /&gt;$td.addClass("range-cell").addClass("css_for_yellow")&lt;BR /&gt;}&lt;BR /&gt;else if (val &amp;gt; 20 ) {&lt;BR /&gt;$td.addClass("range-cell").addClass("css_for_red")&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;var sh = mvc.Components.get("tableWithColorBasedOnAnotherField");&lt;BR /&gt;if (typeof (sh) != "undefined") {&lt;BR /&gt;sh.getVisualization(function (tableView) {&lt;BR /&gt;// Add custom cell renderer and force re-render&lt;BR /&gt;tableView.table.addCellRenderer(new CustomRangeRenderer());&lt;BR /&gt;tableView.table.render();&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;var sh = mvc.Components.get("tableWithColorBasedOnAnotherField1");&lt;BR /&gt;if (typeof (sh) != "undefined") {&lt;BR /&gt;sh.getVisualization(function (tableView) {&lt;BR /&gt;// Add custom cell renderer and force re-render&lt;BR /&gt;tableView.table.addCellRenderer(new CustomRangeRenderer());&lt;BR /&gt;tableView.table.render();&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sourcetype&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 17:05:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564130#M46399</guid>
      <dc:creator>Rukmani_Splunk</dc:creator>
      <dc:date>2021-08-20T17:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564171#M46402</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207122"&gt;@Rukmani_Splunk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var list = cell.field.match('.*count')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;instead of&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var list = cell.field.match('*count')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's working for me.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-08-21 at 10.21.34 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15653iA6AD365E0DE186FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2021-08-21 at 10.21.34 AM.png" alt="Screenshot 2021-08-21 at 10.21.34 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Aug 2021 04:51:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564171#M46402</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-08-21T04:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564331#M46409</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Thanks a lot for your patience . But&amp;nbsp; i&amp;nbsp; get&amp;nbsp; the&amp;nbsp; belwo&amp;nbsp; error when ever&amp;nbsp; i&amp;nbsp; check&amp;nbsp; the developer tools.&lt;/P&gt;&lt;P&gt;"is not defined&lt;BR /&gt;at child.canRender "&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 13:18:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564331#M46409</guid>
      <dc:creator>Rukmani_Splunk</dc:creator>
      <dc:date>2021-08-23T13:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564332#M46410</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207122"&gt;@Rukmani_Splunk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please share you code and sample Output of your search?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 13:26:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564332#M46410</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-08-23T13:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564394#M46411</link>
      <description>&lt;P&gt;i&amp;nbsp; havent cleared the history and it&amp;nbsp; worked&amp;nbsp; thanks a lot&amp;nbsp; ..&lt;/P&gt;&lt;P&gt;u r a genius :):):).. i&amp;nbsp; will&amp;nbsp; accept&amp;nbsp; it as solution&amp;nbsp; .. will&amp;nbsp; this one for two&amp;nbsp; fields&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var test1 = cell.field.match('.*count') // Provide your matching criteria&lt;/P&gt;&lt;P&gt;var test2 = cell.field.match('.*count1')&lt;BR /&gt;&lt;BR /&gt;var list = $.merge(test1 ? test1 : [], test2)&lt;BR /&gt;&lt;BR /&gt;return _(list).contains(cell.field);&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 16:38:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564394#M46411</guid>
      <dc:creator>Rukmani_Splunk</dc:creator>
      <dc:date>2021-08-23T16:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Java script to  have return with  wildcards</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564463#M46412</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/207122"&gt;@Rukmani_Splunk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just replace&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var list = $.merge(test1 ? test1 : [], test2)&lt;/LI-CODE&gt;&lt;P&gt;with&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var list = $.merge(test1 ? test1 : [], test2 ? test2 : [])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 04:54:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Java-script-to-have-return-with-wildcards/m-p/564463#M46412</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-08-24T04:54:53Z</dc:date>
    </item>
  </channel>
</rss>

