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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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