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!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...