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!

Changes to Splunk Instructor-Led Training Completion Criteria

We’re excited to share an update to our instructor-led training program that enhances the learning experience ...

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

❄️ Welcome the new year with our January lineup of Community Office Hours, Tech Talks, and Webinars! &#x1f389; ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...