Dashboards & Visualizations

How to create a Download Report Button in the Dashboard?

antonio147
Communicator

Hello,
I'm having a hard time creating a download button.
I have a scheduled report every day.
I would like to create a button in the dashbard that downloads that report.
I cannot use js.
Can you help me?
I found a way to download the query created but so I also view the table and I don't want to show it, just download the result.

Tks
Bye
Antonio

Labels (1)
0 Karma
1 Solution

antonio147
Communicator

Below is the code for the button.
I solved
I ask the most skilled if this solution can fit

bye
Antonio

 

<search>
<query>| loadjob savedsearch="antonio:enterprise:Report"
</query>
<done>
<eval token="date">strftime(now(), "%d-%m-%Y")</eval>
<set token="file_name">Report</set>
<set token="sid">$job.sid$</set>
</done>
</search>
<html>
<BR/>
<div style="float: left">
<a href="/api/search/jobs/$sid$/results?isDownload=true&amp;timeFormat=%25FT%25T.%25Q%25%3Az&amp;maxLines=0&amp;count=0&amp;filename=$file_name$_$date$.csv&amp;outputMode=csv" class="button js-button">Download Data</a>
</div>
<style>

 

 

View solution in original post

0 Karma

gcusello
Esteemed Legend

Hi @antonio147,

I'm not an expert of HTML but I think that it isn't possible without using a JS.

As a workaround, you could use the standard "Export" button present in every panel.

Ciao.

Giuseppe

0 Karma

antonio147
Communicator

Hi Giuseppe,
I managed to create a download button for a table that I showed above without using js.
so :

<row>
<panel>
<table>
<search>
<done>
<eval token="date">strftime(now(), "%d-%m-%Y")</eval>
<set token="file_name">Tabella_Completa</set>
<set token="sid">$job.sid$</set>
</done>

<query>| loadjob savedsearch="antoino:enterprise:AGGREGATO_DATE"
|rename 00_MESE_PRECEDENTE as "MESE_ATTUALE"

</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">20</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html>

<a href="/api/search/jobs/$sid$/results?isDownload=true&amp;timeFormat=%25FT%25T.%25Q%25%3Az&amp;maxLines=0&amp;count=0&amp;filename=$file_name$_$date$.csv&amp;outputMode=csv" class="button js-button">Estrai Pratiche</a>
<style>
.button {
background-color: steelblue;
border-radius: 5px;
color: white;
padding: .5em;
text-decoration: none;
}

.button:focus,
.button:hover {
background-color: #2A4E6C;
color: White;
}
</style>
</html>
</panel>
</row>


Now my need is to give the possibility to download a report that is in crontab on the Report panel.
I tried to insert it in a table and this is how it works but I can't put the table "hidden".
Also tried with the condition but it doesn't work.
Thanks for your answer
Antonio

0 Karma

antonio147
Communicator

Below is the code for the button.
I solved
I ask the most skilled if this solution can fit

bye
Antonio

 

<search>
<query>| loadjob savedsearch="antonio:enterprise:Report"
</query>
<done>
<eval token="date">strftime(now(), "%d-%m-%Y")</eval>
<set token="file_name">Report</set>
<set token="sid">$job.sid$</set>
</done>
</search>
<html>
<BR/>
<div style="float: left">
<a href="/api/search/jobs/$sid$/results?isDownload=true&amp;timeFormat=%25FT%25T.%25Q%25%3Az&amp;maxLines=0&amp;count=0&amp;filename=$file_name$_$date$.csv&amp;outputMode=csv" class="button js-button">Download Data</a>
</div>
<style>

 

 

0 Karma
Get Updates on the Splunk Community!

The Splunk Success Framework: Your Guide to Successful Splunk Implementations

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

Splunk Training for All: Meet Aspiring Cybersecurity Analyst, Marc Alicea

Splunk Education believes in the value of training and certification in today’s rapidly-changing data-driven ...

Investigate Security and Threat Detection with VirusTotal and Splunk Integration

As security threats and their complexities surge, security analysts deal with increased challenges and ...