Dashboards & Visualizations

How to display a multivalue token, delimited by HTML line break, within a dashboard HTML block (so that each token value is on its own line)?

e040607
Explorer

I have a MultiSelect input, I want to display all the values in a html block; delimited by new line/line break.
I can not get the html to render the line break, just prints it as plain text. How can I delimit my multivalue input by html line break and display the token in a html block?

Here is my test dashboard:

<form>
  <label>Multiselect delimit by Line Break</label>
   <fieldset submitButton="false" autoRun="true">
    <input type="multiselect" token="app_token" searchWhenChanged="true">
      <label>App</label>
      <choice value="Value1">Name1</choice>
      <choice value="Value2">Name2</choice>
      <choice value="Value3">Name3</choice>
      <delimiter>&lt;br/&gt;</br></delimiter>
    </input>
  </fieldset>
  <row>
    <panel>
      <html>
     <p>Display test 1: $app_token$</p>
     <p>Display test 2: $app_token|h$</p>
     <p>Display test 3: $app_token|n$</p>


     <p>Desired output from app_token:</p> 
     <p>Name1<br></br>Name2&lt;br/&gt;</br>Name3</p>

      </html>
    </panel>
  </row>
</form>
Tags (1)
0 Karma

micahkemp
Champion

After some googling, it appears you need to use some javascript to accomplish this. Look at this previous answers post for details.

0 Karma

e040607
Explorer

Unfortunately, my company does not currently allow us to use javascript.
I appreciate the link though, I'll try this in a local installation.

0 Karma

micahkemp
Champion

If you find another way, please be sure to post the answer and accept it.

But, I'd say you should avoid crafting HTML from within a Splunk dashboard. You may consider asking your more general question, something like "I have this data/input/etc and I'd like it to be represented such that this, that, and the other are easily digested". It helps to have some flexibility in terms of what it looks like, so long as the end goal of efficient representation is accomplished.

0 Karma

e040607
Explorer

The initial pasting of my test dashboard foo-barred around the html line break tags.

This one will demonstrate what I'm after without errors:

<form>
    <label>Multiselect delimit by Line Break</label>
     <fieldset submitButton="false" autoRun="true">
      <input type="multiselect" token="app_token" searchWhenChanged="true">
        <label>App</label>
        <choice value="Value1">Name1</choice>
        <choice value="Value2">Name2</choice>
        <choice value="Value3">Name3</choice>
        <delimiter>&lt;br&gt;&lt;/br&gt;</delimiter>
      </input>
    </fieldset>
    <row>
      <panel>
        <html>
       <p>Display test 1: $app_token$</p>
       <p>Display test 2: $app_token|h$</p>
       <p>Display test 3: $app_token|n$</p>


       <p>Desired output from app_token:</p> 
       <p>Value1</p>
       <p>Value2</p>
       <p>Value3</p>

        </html>
      </panel>
    </row>
  </form>
0 Karma
Get Updates on the Splunk Community!

Modern way of developing distributed application using OTel

Recently, I had the opportunity to work on a complex microservice using Spring boot and Quarkus to develop a ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had 3 releases of new security content via the Enterprise Security ...

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...