<?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 Taking a numerical text input for dashboard to narrow down results in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353988#M39354</link>
    <description>&lt;P&gt;Hello.&lt;BR /&gt;
I have achieved result table using sort on a parameter. Here I am directly giving the top 20 highest results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=a sourcetype=b host=* earliest=-6h | sort 0 host time| streamstats current=f window=1 values(du) as prevdu by host |where isnotnull(prevdu) |eval useddiff = du - prevdu | eval velo = useddiff/15 | stats avg(velo) by host| table host avg(velo) | rename avg(velo) as velocity | sort -velocity | head 20
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now the task that I want to achieve is that for an text input field I want to read the input as a number and set this as a threshold and only display the top 20 results crossing the threshold only.&lt;BR /&gt;
I had tried &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=a sourcetype=b host=* earliest=-6h | sort 0 host time | streamstats current=f window=1 values(du) as prevdu by host |where isnotnull(prevdu) |eval useddiff = du - prevdu | eval velo = useddiff/15 | stats avg(velo) by host| table host avg(velo) | rename avg(velo) as velocity | convert num($myinput$) as vthold | where velocity &amp;gt;= vthold |sort -velocity | head 20 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this is not narrowing down the results. I suspet that is because Splunk is reading it as a text. Any suggestions how I could achieve the same.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2017 05:13:46 GMT</pubDate>
    <dc:creator>AshimaE</dc:creator>
    <dc:date>2017-06-15T05:13:46Z</dc:date>
    <item>
      <title>Taking a numerical text input for dashboard to narrow down results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353988#M39354</link>
      <description>&lt;P&gt;Hello.&lt;BR /&gt;
I have achieved result table using sort on a parameter. Here I am directly giving the top 20 highest results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=a sourcetype=b host=* earliest=-6h | sort 0 host time| streamstats current=f window=1 values(du) as prevdu by host |where isnotnull(prevdu) |eval useddiff = du - prevdu | eval velo = useddiff/15 | stats avg(velo) by host| table host avg(velo) | rename avg(velo) as velocity | sort -velocity | head 20
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now the task that I want to achieve is that for an text input field I want to read the input as a number and set this as a threshold and only display the top 20 results crossing the threshold only.&lt;BR /&gt;
I had tried &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=a sourcetype=b host=* earliest=-6h | sort 0 host time | streamstats current=f window=1 values(du) as prevdu by host |where isnotnull(prevdu) |eval useddiff = du - prevdu | eval velo = useddiff/15 | stats avg(velo) by host| table host avg(velo) | rename avg(velo) as velocity | convert num($myinput$) as vthold | where velocity &amp;gt;= vthold |sort -velocity | head 20 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this is not narrowing down the results. I suspet that is because Splunk is reading it as a text. Any suggestions how I could achieve the same.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 05:13:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353988#M39354</guid>
      <dc:creator>AshimaE</dc:creator>
      <dc:date>2017-06-15T05:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Taking a numerical text input for dashboard to narrow down results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353989#M39355</link>
      <description>&lt;P&gt;If values in $myinput$ can be interpreted as numbers, it will be used as a number.  Have you tried'&lt;CODE&gt;| where velocity &amp;gt;=$myinput$&lt;/CODE&gt; instead?  There should be no convert needed.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 05:45:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353989#M39355</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2017-06-15T05:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Taking a numerical text input for dashboard to narrow down results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353990#M39356</link>
      <description>&lt;P&gt;Yes I did try that. No narrowing down was there.. Also I need to consider decimal point numbers as my input as well.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 06:31:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353990#M39356</guid>
      <dc:creator>AshimaE</dc:creator>
      <dc:date>2017-06-15T06:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Taking a numerical text input for dashboard to narrow down results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353991#M39357</link>
      <description>&lt;P&gt;@AshimaE, like @yuanliu mentioned, you should be able to use numeric comparison directly from numeric value passed on from the text box. There is not need for convert the same.&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search which performs digit validation on textbox (you can write more specific JavaScript Regular Expression as per your needs). The token tokVelThold to be used in search gets set only when all characters entered in Text Box are digits, otherwise the Search Panel remains hidden since the token is not set.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="text" token="selVelThold"&amp;gt;
      &amp;lt;label&amp;gt;Add threshold&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
          &amp;lt;eval token="tokVelThold"&amp;gt;case(match(value, &amp;amp;quot;^[0-9]+$&amp;amp;quot;), $value$)&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;tokVelThold: $tokVelThold$&amp;lt;/title&amp;gt;
      &amp;lt;table depends="$tokVelThold$"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| eval velocity=1000
| eval vthold=$tokVelThold$
| where velocity &amp;amp;gt;= vthold 
| sort -velocity
| head 20&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;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Alternatively you can also pass all values from the Text Box to the token and default the the value to 0 in case it is not number through  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval velThold=$selVelThold$ 
| eval velThold=case(isnum(velThold),velThold,true(),0)
| where velocity &amp;amp;gt;= vthold 
| sort -velocity
| head 20
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 06:50:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353991#M39357</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-15T06:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Taking a numerical text input for dashboard to narrow down results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353992#M39358</link>
      <description>&lt;P&gt;The alternative worked well for the case. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 10:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353992#M39358</guid>
      <dc:creator>AshimaE</dc:creator>
      <dc:date>2017-06-15T10:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Taking a numerical text input for dashboard to narrow down results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353993#M39359</link>
      <description>&lt;P&gt;Hi @AshimaE, I have converted my comment to Answer, please Accept if it helped. In the Regular Expression you can handle decimal as well (if you want to perform floating number validation).&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 12:36:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Taking-a-numerical-text-input-for-dashboard-to-narrow-down/m-p/353993#M39359</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-06-15T12:36:35Z</dc:date>
    </item>
  </channel>
</rss>

