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!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...