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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...