Dashboards & Visualizations

Display data from two rows when using drilldown

Splunk_noobie
Path Finder

Hi All,

 

I have a table with 5 rows as shown below.

Report      Count     Comments
Report 1    22         abc
Report 2    786        def
Report 3    10,037     ghi
Report 4    719        jkl

When I click on any row, it displays data for that row using the <option name="drilldown">row</option> in my template like this :

Hi Team, 
According to our splunk logs below are the top reports having high count:  

Report: Report1
Comment: abc
Count: 22

If you have any questions please feel free to contact us. 

Regards 

Support Team

 ---------END of my display message----------

Now when i click 2nd row(after clicking the first row) I want 2nd row data also to be displayed along with the above results so that the output looks like this: 

Hi Team, 
According to our splunk logs below are the top reports having high count:  

Report: Report1
Comment: abc
Count: 22

Report: Report2
Comment: def
Count: 786

If you have any questions please feel free to contact us. 

Regards 

Support Team

 ---------END of my display message----------

 

This is the code i have used : 

<row> 
<panel> 
<table> 
<title>click a row for more details</title> 
<search base="main_search"> <query>| table reportName count comments</query> 
</search> 
<option name="count">10</option> 
<option name="dataOverlayMode">none</option> 
<option name="drilldown">row</option> 
<option name="refresh.display">progressbar</option>
 <option name="rowNumbers">false</option> 
<option name="wrap">true</option> 
<fields>$table_fields$</fields> 
<drilldown> 
<eval token="customer_comment_en"> 
" Report: ".$ReportId$." 
Count: ".$count$." 
Comments: ".$comment$." 
" 
</eval> 
<set token="drilldown_display">block</set> 
</drilldown> 
</table> 
</panel> 
</row> 
<row depends="$drilldown_display$"> 
<panel> <html> <h1 class="SectionHeader">Customer Communication</h1> <div style="float:left; width:calc(95% - 50px);" class="pageInfo"> 
<pre> 
Hi Team, According to our splunk logs below are the top reports having high count: 
$customer_comment_en$ 

If you have any questions please feel free to contact us. 
Regards Support Team 
</pre> 
</div> 
</html> 
</panel> 
<panel> 

Basically i want to access data for not just one row, but multiple rows when i click on them and display

Can anyone help?

 

 

 

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try removing the extra newline after $customer_comment_en$.

<eval token="customer_comment_en">if(isnull($customer_comment_en$),"
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
",$customer_comment_en$."
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
")
</eval>

View solution in original post

Splunk_noobie
Path Finder

Perfecto @ITWhisperer  That feeling after you work on a problem for days and finally it works !!!!

 

Just another quick question if you could help?

I have a panel displaying tabular data.

I want to display the top 3 rows from that table in my template block. How do we achieve this?

Let me know if you want me to create a separate thread for this. 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I think you need a separate thread for this, partly so that you (and others) will know when there is a solution.

However, what is wrong with the table visualisation with the query limited to 3 results (head 3)?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
<drilldown> 
<eval token="customer_comment_en">$customer_comment_en$. 
" Report: ".$ReportId$." 
Count: ".$count$." 
Comments: ".$comment$." 
" 
</eval> 
<set token="drilldown_display">block</set> 
</drilldown> 
0 Karma

Splunk_noobie
Path Finder

Hi @ITWhisperer 

 

Thanks for the quick turnaround. I guess you got my question wrong. The intention here is 

->  jobId :  ".$row.jobId$." gives me the result of the row I clicked ( which is easy and common to implement) 

jobId: 7828978761cjk

-> Now when I click another row from the table, I want that result to be added to the previous data

jobId: 7828978761cjk  (result from the previous click)

jobId: 9887521348typ (result from current click) 

 

Is there any ".$row2.jobId$." function that I can use? 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I guess you got my answer wrong! The eval in the drilldown takes the current contents of the token and dot-appends the new data

<eval token="customer_comment_en">$customer_comment_en$.

Splunk_noobie
Path Finder

@ITWhisperer Got your point. That's a really good solution 😄 

I just tried adding the red text below as suggested by you in my dashboard and it doesn't work. Any thoughts?

 

<drilldown target="_blank">
<eval token="customer_comment_en">$customer_comment_en$. 
"
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
"
</eval>

  <set token="drilldown_display">block</set>

</drilldown>


<row depends="$drilldown_display$">
<panel> <!-- Customer comment template with row data -->
<html>
<h1 class="SectionHeader">Case Updation Template </h1>
<div style="float:left; width:calc(95% - 100px);" class="pageInfo">
<pre>
Hi Team,

Please check the below data from our query: 
$customer_comment_en$

</pre>

</div>
</html>
</panel>

</row>

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

OK it looks like we need to deal with the situation where the token is null

<eval token="customer_comment_en">if(isnull($customer_comment_en$),"
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
",$customer_comment_en$. 
"
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
")
</eval>
0 Karma

Splunk_noobie
Path Finder

@ITWhisperer Yep. Agree with logic. It's a good one, 

but the only output in my template block is :

Hi Team,

Please check the below data from our query: 
$customer_comment_en$ 
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try removing the extra newline after $customer_comment_en$.

<eval token="customer_comment_en">if(isnull($customer_comment_en$),"
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
",$customer_comment_en$."
jobId : ".$row.jobId$."
User ID : ".$row.userId$."
")
</eval>
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...