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!

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...

AppDynamics is now part of Splunk Ideas

Hello Splunkers, We have exciting news for you! AppDynamics has been added to the Splunk Ideas Portal. Which ...

Advanced Splunk Data Management Strategies

Join us on Wednesday, May 14, 2025, at 11 AM PDT / 2 PM EDT for an exclusive Tech Talk that delves into ...