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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...