<?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: Why does a single single-value panel cause SplunkJS exception &amp;quot;Cannot read properly 'length' of undefined&amp;quot; in Splunk 6.3.0 in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275400#M17432</link>
    <description>&lt;P&gt;Hi again, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/177720"&gt;@smichalski&lt;/a&gt;,&lt;BR /&gt;
We're looking at your query and have a suggestion. Could you give some more details on what you wanted the query to do? Specifically, how would you like "timechart" and "head" to work for you in this query? I see that "showSparkline" and "showTrendIndicator" are false in the simpleXML options, so there might be other query options we can suggest, depending on the single value visualization you want.&lt;/P&gt;

&lt;P&gt;Relatedly, if you use "timechart count", the query aggregates to a single value. Piping to "head 1" before and/or after that could cause some of the issues you are seeing. &lt;/P&gt;

&lt;P&gt;If you try this:&lt;BR /&gt;
"index=_internal | timechart count"&lt;BR /&gt;
or &lt;BR /&gt;
"index=_internal | head 2| timechart count"&lt;BR /&gt;
or&lt;BR /&gt;
"index=_internal | stats count" &lt;BR /&gt;
"index =_internal | stats values()"&lt;BR /&gt;
(the above queries with the "stats" command will not create a sparkline or trend indicator)&lt;/P&gt;

&lt;P&gt;Do either of these queries yield the results you want? Let me know how this works.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
@frobinson_splunk&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:43:56 GMT</pubDate>
    <dc:creator>frobinson_splun</dc:creator>
    <dc:date>2020-09-29T07:43:56Z</dc:date>
    <item>
      <title>Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275398#M17430</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;

&lt;P&gt;While checking our dashboards for migration to Splunk 6.3.0, I faced an issue with the redesigned single-value elements which truly base on a "single" value. Setting the numberPrecision option to another value than default (= 0) seems to cause a SplunkJS error that breaks the dashboard.&lt;/P&gt;

&lt;P&gt;For tracking down the issue, I ended up on using the "simple_single" dashboard from the dashboard examples v4.0. Within that dashboard, we find an example for a single-value element without decorations:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;single&amp;gt;
  &amp;lt;title&amp;gt;No decorations&amp;lt;/title&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index=_internal | timechart count&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;option name="colorBy"&amp;gt;value&amp;lt;/option&amp;gt;
  &amp;lt;option name="colorMode"&amp;gt;none&amp;lt;/option&amp;gt;
  &amp;lt;option name="numberPrecision"&amp;gt;0&amp;lt;/option&amp;gt;
  &amp;lt;option name="showTrendIndicator"&amp;gt;0&amp;lt;/option&amp;gt;
  &amp;lt;option name="showSparkline"&amp;gt;0&amp;lt;/option&amp;gt;
  &amp;lt;option name="useColors"&amp;gt;0&amp;lt;/option&amp;gt;
  &amp;lt;option name="useThousandSeparators"&amp;gt;1&amp;lt;/option&amp;gt;
  &amp;lt;option name="linkView"&amp;gt;search&amp;lt;/option&amp;gt;
  &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
&amp;lt;/single&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I just change numberPrecision to "0.00" the dashboard works fine. If I add an &lt;CODE&gt;| head 1&lt;/CODE&gt; to the search, the dashboard breaks. When changing to &lt;CODE&gt;| head 2&lt;/CODE&gt; and larger, the dashboard works again. Unfortunately, we designed most of our single value searches to return just one value, in order to avoid Splunk displaying the wrong one.&lt;/P&gt;

&lt;P&gt;Error messages of browsers:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Chrome 46.0.2490.71 JS console: "Uncaught TypeError: Cannot read property 'length' of undefined"
Firefox 41.0.2 JS console: "TypeError: C.split(...)[1] is undefined mvc.js:6:2048500"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Am I configuring anything wrong or am I facing a bug here?&lt;/P&gt;

&lt;P&gt;Cheers, Sven&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2015 06:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275398#M17430</guid>
      <dc:creator>smichalski</dc:creator>
      <dc:date>2015-10-17T06:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275399#M17431</link>
      <description>&lt;P&gt;Hi @smichalski,&lt;BR /&gt;
I'm going to run this by our engineering team to see what we can suggest. Stay tuned!&lt;BR /&gt;
@frobinson_splunk&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 17:17:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275399#M17431</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2015-10-28T17:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275400#M17432</link>
      <description>&lt;P&gt;Hi again, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/177720"&gt;@smichalski&lt;/a&gt;,&lt;BR /&gt;
We're looking at your query and have a suggestion. Could you give some more details on what you wanted the query to do? Specifically, how would you like "timechart" and "head" to work for you in this query? I see that "showSparkline" and "showTrendIndicator" are false in the simpleXML options, so there might be other query options we can suggest, depending on the single value visualization you want.&lt;/P&gt;

&lt;P&gt;Relatedly, if you use "timechart count", the query aggregates to a single value. Piping to "head 1" before and/or after that could cause some of the issues you are seeing. &lt;/P&gt;

&lt;P&gt;If you try this:&lt;BR /&gt;
"index=_internal | timechart count"&lt;BR /&gt;
or &lt;BR /&gt;
"index=_internal | head 2| timechart count"&lt;BR /&gt;
or&lt;BR /&gt;
"index=_internal | stats count" &lt;BR /&gt;
"index =_internal | stats values()"&lt;BR /&gt;
(the above queries with the "stats" command will not create a sparkline or trend indicator)&lt;/P&gt;

&lt;P&gt;Do either of these queries yield the results you want? Let me know how this works.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
@frobinson_splunk&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:43:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275400#M17432</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2020-09-29T07:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275401#M17433</link>
      <description>&lt;P&gt;Also, separately from troubleshooting your query, we've filed a bug for the JS error you are seeing. Thanks for pointing this out!&lt;BR /&gt;
Best,&lt;BR /&gt;
@frobinson_splunk&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 20:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275401#M17433</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2015-10-28T20:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275402#M17434</link>
      <description>&lt;P&gt;Hi frobinson_splunk, the query above is just an example to make reproduction of the issue easy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; The actual issue we ran into after testing upgrading from Splunk 6.1.1 to 6.3.0 was the following:&lt;/P&gt;

&lt;P&gt;Imagine an (HTML) dashboard containing multiple postprocessing searches. The base searches deliver multidimensional longterm data (e. g. via &lt;CODE&gt;| WHERE _time &amp;gt;= relative_time(now(),"-3mon@mon") AND _time &amp;lt; relative_time(now(),"-0mon@mon") | bucket _time span=1d | stats count by _time, country, service, return_code&lt;/CODE&gt;), from which postprocessing searches draw their charts (e. g. &lt;CODE&gt;| timechart span=1d sum(count) by service)&lt;/CODE&gt;). Parallely, there are postprocessing searches which grab the base search's result to only display an overall value of the last month as a single value element (e. g. &lt;CODE&gt;| WHERE service="foo" | WHERE _time &amp;gt;= relative_time(now(),"-1mon@mon") AND _time &amp;lt; relative_time(now(),"-0mon@mon") | timechart span=1mon sum(count) as count)&lt;/CODE&gt;). That way, the result table for the single value will lead to a single row containing a _time column and a count column.&lt;/P&gt;

&lt;P&gt;In 6.1, this approach of limiting the time range worked fine. Since 6.3.0 (or 6.2, I cannot tell), it produces a SplunkJS exception when adding the numberPrecision option and changing its value to "0.00". The issue seems to be related to the _time column: When that column is removed (e. g. by &lt;CODE&gt;| fields - _time&lt;/CODE&gt;) or not passed on (e. g. by using &lt;CODE&gt;| stats sum(count) as count&lt;/CODE&gt;), the single value elements gets displayed. So yes, removing _time works as a solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Though I still need getting used to that implementation. It's strange that you don't have to remove the _time column when leaving the numberPrecision to default ("0").&lt;/P&gt;

&lt;P&gt;Another solution would be turning the result into a string (&lt;CODE&gt;index=_internal | timechart count | head 1 | eval count=round(count/1000000,2) . " Mio."&lt;/CODE&gt;). But then the numberPrecision option has no effect of course ...&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 20:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275402#M17434</guid>
      <dc:creator>smichalski</dc:creator>
      <dc:date>2015-10-28T20:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275403#M17435</link>
      <description>&lt;P&gt;Oh, I hadn't seen your answer before sending my comment above. Thanks for providing some clarity!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 20:52:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275403#M17435</guid>
      <dc:creator>smichalski</dc:creator>
      <dc:date>2015-10-28T20:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275404#M17436</link>
      <description>&lt;P&gt;Thanks for the additional details, @smichalski! Passing them along to our engineering team.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 21:14:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275404#M17436</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2015-10-28T21:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why does a single single-value panel cause SplunkJS exception "Cannot read properly 'length' of undefined" in Splunk 6.3.0</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275405#M17437</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am also saming the same issue while using the Single Value chart to display trendz for a field (which returns value with precision) and _time used within the query.&lt;/P&gt;

&lt;P&gt;The issue remains only in Chrome and not with Safari and Firefox. Post loading the dashboard, few panels which take a bit longer to run, keep displaying "Loading Results"...&lt;/P&gt;

&lt;P&gt;Do we have any solution for this issue.&lt;BR /&gt;
I am using Splunk version 6.3.3&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 10:30:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Why-does-a-single-single-value-panel-cause-SplunkJS-exception/m-p/275405#M17437</guid>
      <dc:creator>rahulrawlani</dc:creator>
      <dc:date>2016-11-16T10:30:41Z</dc:date>
    </item>
  </channel>
</rss>

