Dashboards & Visualizations

Problem with space character in simple xml for dashboard

C_Sparn
Communicator

Hello,

I have the problem, that space characters are not saved in the simple xml structure of my dashboards. This is a part of one of my dashboards:

<input type="multiselect" token="group" searchWhenChanged="true">
  <label>group by...</label>
  <choice value="ChangeDay">Day</choice>
  <prefix>by </prefix>
  <delimiter> </delimiter>
</input>

You can see that I have a space character at delimiter and one after by. That one at deleimiter is saved correctly, but that after by is deleted after a reload. How can I save all space characters permanently?

Greetings

1 Solution

jkat54
SplunkTrust
SplunkTrust

What happens if you use &#32; instead of spaces?

<prefix>by&#32;</prefix>

View solution in original post

afishkin_splunk
Splunk Employee
Splunk Employee

Space for is not trimmed, just leave as
Try by

0 Karma

C_Sparn
Communicator

The space between delimiter is saved permanently, so there is no problem, but the space after by is deleted after reopening/reloading the dashboard.

0 Karma

jkat54
SplunkTrust
SplunkTrust

What happens if you use &#32; instead of spaces?

<prefix>by&#32;</prefix>

jkat54
SplunkTrust
SplunkTrust

updated, way to think outside the box and build upon my idea!

0 Karma

jkat54
SplunkTrust
SplunkTrust

For anyone else showing up here that doesn't understand the solution; I'll explain why this works and how to use the same technique for other characters too.

It works because this is the percent encoded value for what is the spacebar. Percent encoding is used in a variety of ways including urlencoding. It's a way to avoid passing special characters which may be misinterpreted by your web app (in this case the splunk web UI).

More here:

 https://en.m.wikipedia.org/wiki/Percent-encoding

There are plenty of urlencoding reference websites if you'd like to encode your own characters. But my favorite method is with TA Web Tools (shameless self promotion).

https://splunkbase.splunk.com/app/3420/

0 Karma

C_Sparn
Communicator

Nice idea with using   but that is not accepted by splunk. But I also tried &#32 and this is working now!
Thanks for the help. Can you cahnge your answer to &#32 (don't forget the ; after 32) that I can vote for it?

Greetings

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...