All Apps and Add-ons

How to format the HTML in automatic simple xml dashboard?

Sukisen1981
Champion

Hi,
I have a small question on simple xml html panels. Below is my code
<panel>
<html>
<div style="text-align: left;">
<h3>Duration</h3>
<div class="custom-result-value">$duration$</div>
</div>
<div style="text-align: center;">
<h3>Start Time</h3>
<div class="custom-result-value">$starttime$</div>
</div>
<div style="text-align: right;">
<h3>Result Rows</h3>
<div class="custom-result-value">$resultcount$</div>
</div>
</html>
</panel>

So what is happening is that duration.start time and result rows are picked from the token values. Now. the values are correctly coming aligned left,center and right as stated in the above code, however they are line breaks between them, please refer
alt text

I am not that good in HTML and need some help 🙂 🙂

0 Karma
1 Solution

poete
Builder

Hello @Sukisen1981,

I created a html table from your input, and here it is.

<html> 
<table style="width:100%">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
  </tr>
  <tr>
    <td style="text-align: center;">$duration$</td>
    <td style="text-align: center;">$starttime$</td>
    <td style="text-align: center;">$resultcount$</td>
  </tr>
</table>
</html>

View solution in original post

manish_singh_77
Builder

Hi Sukisen,

HTML table would be perfect fit for this case. We can use Css for style and alignment along with HTMl table for this requirement.

Find below the source code and let me know in case of any queries.

<dashboard>
  <label>Test</label>
     <row>
    <panel>
   <html>
     <style>
     #sla_table {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

#sla_table td, #sla_table th {
    border: 1px solid #ddd;
    padding: 2px;
}

#sla_table th {
    padding-top: 2px;
    padding-bottom: 2px;
    text-align: left;
    background-color: #C0C0C0;
    color: black;
}

</style>
    <table id = "sla_table">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
     </tr>
  <tr>
    <td>$duration$</td>
    <td>$starttime$</td>
    <td>$resultcount$</td>
      </tr>
  </table>
  </html>
  </panel>
  </row>
</dashboard>

Sukisen1981
Champion

Hi @manish_singh_777 thanks for your detailed answer, the answer provided by @poete works and I have accepted it, nevertheless many thanks for your detailed reply 🙂

0 Karma

poete
Builder

Hello @Sukisen1981,

I created a html table from your input, and here it is.

<html> 
<table style="width:100%">
  <tr>
    <th>Duration</th>
    <th>Start Time</th> 
    <th>Result Rows</th>
  </tr>
  <tr>
    <td style="text-align: center;">$duration$</td>
    <td style="text-align: center;">$starttime$</td>
    <td style="text-align: center;">$resultcount$</td>
  </tr>
</table>
</html>

Sukisen1981
Champion

Gratefully accepted and I can understand the issue as well. I am sorry, I know this is a simple issue but I honestly did not have time to explore stuff, given my limited HTML knowledge. Thanks again

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...

Index This | How many sevens are there between 1 and 100?

August 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...