Splunk Search

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

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

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, an upvote would be appreciated.
0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!