Knowledge Management

How to set option of numberprecision value based on the query result into the dashboard?

manibattula
New Member

While developing the splunk dash board,I should display result number up to 3 decimal point if those are having values(other thanszero) after dot .

example,if I have 2 querires, 1 case result 99.789 and 2 case having result has 99.000 in this case is should disply 1 case 99.789 but for the second case it displaying 99.000 instead of 99.

I have tried some condition like below.

global declaration for input

 <set token="precisionVal">0.000</set>

condition in side the search

          <set token="overall_pctg">$result.total_pctg$</set>
        </condition>
        <condition match=" '$overall_pctg$' == 100">
          <set token="precisionVal">0</set>
        </condition>

and apply the token in input field like below
$precisionVal$

but still I am getting as 0.[0-9][0-9][0-9]

Tags (1)
0 Karma

manjunathmeti
Champion

Use eval expression in done element instead of using condition.

<search>
      <query>
        ...
      </query>
      <done>
          <eval token="precisionVal">case(match($result.overall_pctg$, "100.000"), 0, match($result.overall_pctg$, "\.[0]{3}$"), floor($result.overall_pctg$), 1==1, $result.overall_pctg$)</eval>
      </done>
</search>
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...