All Apps and Add-ons

Display table values in HTML module

adityapavan18
Contributor

Hi

Lets say the result of a query is a table like below:

A        B


1        Name1

2        Name2

generally selecting results[0].A will give me "1" and results[0].B will give me "Name1" and so on.

But is it possible to disply values of B using values of A. like trying results.A["1"] so that i can get Name1

sideview
SplunkTrust
SplunkTrust

You should not be using the HTML module to generate a simple table of data. It is an extremely silly thing to do. The HTML module's docs actually do have an example of this but I'm going to take it out because I think it's the reason why people keep asking weird questions about this. 99.9% of the time it is both better and easier to use the Table or SimpleResultsTable modules instead.

Instead of your HTML module with all your complicated HTML and $foo$ tokens, you should have just have these three lines of XML:

<module name="Pager">
  <module name="Table" />
</module>

The Table module has its own documentation in Sideview Utils. Strangely, I've been getting a lot of questions just like this. It makes me wonder if people are focusing on the HTML module documentation first because they think if they can understand the HTML module then they can just do everything with that one module. While this makes a certain kind of sense in the abstract, it is absolutely not the case here. If you want a text input of some kind, use the TextField module always. If you want a checkbox use the Checkbox module. If you want a series of tabs, use the Tabs module, and so on and so forth.

The HTML module is great for displaying headers and simple text, with dynamic content, dynamic background-colors and even images. But if you try and take it beyond that you'll be taking a spoon to a gunfight.

sideview
SplunkTrust
SplunkTrust

All Sideview Utils documentation (and there's a ton of it), is actually in the app itself. This is because each page contains a living example of the configuration it's discussing. You can find the pages of HTML module docs under "Module Documentation > The HTML Module"

0 Karma

adityapavan18
Contributor

I know that Table module is more agile than using HTML module. But the way i am planning to design the Dashboard, its more useful if i am able to show it in HTML module. You said in your answer that HTML module docs have an example for this, can u provide me the link to that docs?

0 Karma
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 ...