Splunk Search

Insert "%" symbol to a number without converting it to string

jvmerilla
Path Finder

Hi,

Is it possible to add a "%" character/symbol to a number without converting it to a string?

I tried to use this code:
| eval percentage = round((On_time/Total)*100)."%"

But it converted the number into a string, so when I try to use the "percentage" field as an overlay in a Column Chart, it does not show anything. It has to be an integer.
I want it to have the "%" character so that when I hover over the overlay, the value would have the "%" sign so that it would be easy to know that it is a percentage, not just any number.

Is this possible?

I hope anyone can help me with this.

Thank you.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

By definition, a field with anything other than digits or '.' is a string. There is no way around that.
If you were using a pie chart, you could use the SimpleXML charting.chart.showPercent option to display percentages, but that is not supported by other chart types.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

March Community Office Hours Security Series Uncovered!

Hello Splunk Community! In March, Splunk Community Office Hours spotlighted our fabulous Splunk Threat ...

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars in April. This post ...