All Apps and Add-ons

How to display row number with sideview Table Module

disha
Contributor

I am using sideview Table module instead of SimpleResultsTable.
1.I want to display the row numbers in the table .
2. I want to total number of events display at the top of the table.
Please suggest.
Thanks,

1 Solution

sideview
SplunkTrust
SplunkTrust

It's very simple to use the search language to display row numbers, so I decided not to build it into the Table module as a primary feature.

If you do not already have a PostProcess module around this particular Table, then just wrap it in this:

<module name="PostProcess">
  <param name="search">streamstats count as row | fields row *</param>

And if you do already have a PostProcess, well just tack on streamstats count as row onto the end. Assuming you're using the more flexible $row.fields.fieldName$ keys in drilldown config, it wont disrupt anything by there suddenly being a first column called "row". (Of course if for some reason you're still using SimpleResultsTable and you're still using the old $click.value$ syntax, well the $click.value$ will now be the row number which would be bad)

As to your second question, displaying the total number of events at the top of the table is as simple as using $results.count$ in an HTML module. Generally the whole thing will look like this:

... assuming that there is a Search module upstream ... 

<module name="HTML">
  <param name="html"><![CDATA[
    <h3>$results.count$ results $search.timeRange.label$</h3>
  ]]></param>
</module>
<module name="JobProgressIndicator"></module>
<module name="Pager">
  <module name="Table" />
</module>

And if you would rather display preview results in the Table while the search is running then you want to replace that JobProgressIndicator with Splunk's EnablePreview module, like so:

<module name="EnablePreview">
  <param name="enable">True</param>
  <param name="display">False</param>
</module>

View solution in original post

sideview
SplunkTrust
SplunkTrust

It's very simple to use the search language to display row numbers, so I decided not to build it into the Table module as a primary feature.

If you do not already have a PostProcess module around this particular Table, then just wrap it in this:

<module name="PostProcess">
  <param name="search">streamstats count as row | fields row *</param>

And if you do already have a PostProcess, well just tack on streamstats count as row onto the end. Assuming you're using the more flexible $row.fields.fieldName$ keys in drilldown config, it wont disrupt anything by there suddenly being a first column called "row". (Of course if for some reason you're still using SimpleResultsTable and you're still using the old $click.value$ syntax, well the $click.value$ will now be the row number which would be bad)

As to your second question, displaying the total number of events at the top of the table is as simple as using $results.count$ in an HTML module. Generally the whole thing will look like this:

... assuming that there is a Search module upstream ... 

<module name="HTML">
  <param name="html"><![CDATA[
    <h3>$results.count$ results $search.timeRange.label$</h3>
  ]]></param>
</module>
<module name="JobProgressIndicator"></module>
<module name="Pager">
  <module name="Table" />
</module>

And if you would rather display preview results in the Table while the search is running then you want to replace that JobProgressIndicator with Splunk's EnablePreview module, like so:

<module name="EnablePreview">
  <param name="enable">True</param>
  <param name="display">False</param>
</module>

disha
Contributor

Thanks Nick..U rocks..!!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...