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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...