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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...