<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Drill down to absolute URL using click.value in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19158#M671</link>
    <description>&lt;P&gt;I managed to get it work. Both are not the best way, but it works for me.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;
Convert it yo HTML&lt;BR /&gt;
Change the below line:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;// var url = TokenUtils.replaceTokenNames("{{SPLUNKWEB_URL_PREFIX}}/app/lionel/$click.value2$", _.extend(submittedTokenModel.toJSON(), e.data), TokenUtils.getEscaper('url'));
var url = TokenUtils.replaceTokenNames("$click.value2$", _.extend(submittedTokenModel.toJSON(), e.data));
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;BR /&gt;
Write a javascript that will accept the full url as a get data, which will redirect to the url.&lt;BR /&gt;
Here is the redirect javascript:- (eg:- &lt;A href="http://mydomain/redirect.html"&gt;http://mydomain/redirect.html&lt;/A&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;script&amp;gt;
    function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&amp;amp;]" + name + "=([^&amp;amp;#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    window.location = getParameterByName("goto");
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so now, from the simpleXML of the dashboard, it should look like this:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;drilldown target="_blank"&amp;gt;
      &amp;lt;link&amp;gt;http://mydomain/redirect.html?goto=$click.value2$&amp;lt;/link&amp;gt;
    &amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 01 Dec 2015 00:26:40 GMT</pubDate>
    <dc:creator>lionel319</dc:creator>
    <dc:date>2015-12-01T00:26:40Z</dc:date>
    <item>
      <title>Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19154#M667</link>
      <description>&lt;P&gt;I have a simple table where one column contains a URL. I would like to redirect to that url and if possible in a new window.&lt;/P&gt;

&lt;P&gt;like so:&lt;BR /&gt;
&lt;DRILLDOWN&gt;&lt;BR /&gt;
     &lt;LINK field="link" /&gt;$row.link$&lt;BR /&gt;
&lt;/DRILLDOWN&gt;  &lt;/P&gt;

&lt;P&gt;it redirects to the current URL plus $row.link$ &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
I suspect, that Splunk checks if the link tag starts with http* &lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2013 15:45:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19154#M667</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2013-04-29T15:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19155#M668</link>
      <description>&lt;P&gt;I am seeing this exact same issue. I am surprised it hasnt been fixed almost a year on.&lt;/P&gt;

&lt;P&gt;My row is like this but it still leaves everything encoded&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;Asset threats over last 60 days&amp;lt;/title&amp;gt;
        &amp;lt;searchString&amp;gt;index=cve-details vendor_id=$vendor_id$ | join vendor_id [ | inputlookup asset-list.csv ] | eval url=urldecode(url) | sort update_date desc | table asset_code, asset_name, vendor_name, cve_id, cwe_name, publish_date, update_date, summary, url&amp;lt;/searchString&amp;gt;
        &amp;lt;earliestTime&amp;gt;-60d&amp;lt;/earliestTime&amp;gt;
        &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
          &amp;lt;option name="count"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
            &amp;lt;link&amp;gt;&amp;lt;![CDATA[ $row.url$ ]]&amp;gt;&amp;lt;/link&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My link ends up looking like this. (not it is still encoded for URLs which is should not be)&lt;/P&gt;

&lt;P&gt;So for a row with&lt;BR /&gt;
url = &lt;A href="http://www.cvedetails.com/cve/cve-2013-1763//"&gt;http://www.cvedetails.com/cve/cve-2013-1763//&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The drilldown link is &lt;BR /&gt;
&lt;A href="http://my.splunk.server.com.au:8000/en-US/app/cvedetails/http%3A%2F%2Fwww.cvedetails.com%2Fcve%2FCVE-2013-1763%2F"&gt;http://my.splunk.server.com.au:8000/en-US/app/cvedetails/http%3A%2F%2Fwww.cvedetails.com%2Fcve%2FCVE-2013-1763%2F&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Is there anyway to get the raw text of the field to be the link?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jul 2014 06:14:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19155#M668</guid>
      <dc:creator>phoenixdigital</dc:creator>
      <dc:date>2014-07-10T06:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19156#M669</link>
      <description>&lt;P&gt;This behavior is due to purposeful url escaping in the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.2/Viz/Dynamicdrilldownindashboardsandforms" target="_blank"&gt;dynamic drilldown&lt;/A&gt; feature.&lt;/P&gt;

&lt;P&gt;There is an example of using an external link in the &lt;A href="http://apps.splunk.com/app/1603/" target="_blank"&gt;Splunk 6.x Dashboard Examples app&lt;/A&gt; version 2.0.1 (&lt;STRONG&gt;NB&lt;/STRONG&gt;: The external link example is not available in version 1.0 of that app). The page named "Drilldown URL Field Value" provides an example of how to render an external link in a separate clickable column. Below, I'll paste a generic example, using that example's JS as a base, but updating it to make the original column a clickable link to an external page.&lt;/P&gt;

&lt;P&gt;In the simple XML, we reference a JavaScript file named &lt;CODE&gt;drilldown_external_url.js&lt;/CODE&gt; (which should be in the app's appserver/static directory), we add an ID to the table (&lt;CODE&gt;external_link&lt;/CODE&gt;), and we disable drilldown. Here's the simple XML: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="drilldown_external_url.js"&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;table id="external_link"&amp;gt;
      &amp;lt;searchString&amp;gt;| stats count  | eval target="http://splunk.com"&amp;lt;/searchString&amp;gt;
      &amp;lt;earliestTime&amp;gt;$earliest$&amp;lt;/earliestTime&amp;gt;
      &amp;lt;latestTime&amp;gt;$latest$&amp;lt;/latestTime&amp;gt;
      &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
      &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;option name="count"&amp;gt;10&amp;lt;/option&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We update the JavaScript to reference the table ID (&lt;CODE&gt;external_link&lt;/CODE&gt;) and the field name's column (&lt;CODE&gt;target&lt;/CODE&gt;). If the table name or field name is different in your simple XML, be sure to update the JS accordingly. Here is the drilldown_external_url.js&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
    var CustomLinkRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            return cell.field === 'target';
        },
        render: function($td, cell) {
            var link = cell.value;
            var a = $('&amp;lt;a&amp;gt;').attr("href", cell.value).text(cell.value);
            $td.addClass('table-link').empty().append(a);

            a.click(function(e) {
              e.preventDefault();
              window.location = $(e.currentTarget).attr('href');
              // or for popup:
              // window.open($(e.currentTarget).attr('href'));
            });
        }
    });

        // Get the table view by id
        mvc.Components.get('external_link').getVisualization(function(tableView){
        // Register custom cell renderer
        tableView.table.addCellRenderer(new CustomLinkRenderer());
        // Force the table to re-render
        tableView.table.render();
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19156#M669</guid>
      <dc:creator>bwooden</dc:creator>
      <dc:date>2020-09-28T17:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19157#M670</link>
      <description>&lt;P&gt;Great answer - works like a charm.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2014 22:42:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19157#M670</guid>
      <dc:creator>jhupka</dc:creator>
      <dc:date>2014-07-23T22:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19158#M671</link>
      <description>&lt;P&gt;I managed to get it work. Both are not the best way, but it works for me.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;
Convert it yo HTML&lt;BR /&gt;
Change the below line:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;// var url = TokenUtils.replaceTokenNames("{{SPLUNKWEB_URL_PREFIX}}/app/lionel/$click.value2$", _.extend(submittedTokenModel.toJSON(), e.data), TokenUtils.getEscaper('url'));
var url = TokenUtils.replaceTokenNames("$click.value2$", _.extend(submittedTokenModel.toJSON(), e.data));
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;BR /&gt;
Write a javascript that will accept the full url as a get data, which will redirect to the url.&lt;BR /&gt;
Here is the redirect javascript:- (eg:- &lt;A href="http://mydomain/redirect.html"&gt;http://mydomain/redirect.html&lt;/A&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;script&amp;gt;
    function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&amp;amp;]" + name + "=([^&amp;amp;#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    window.location = getParameterByName("goto");
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so now, from the simpleXML of the dashboard, it should look like this:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;drilldown target="_blank"&amp;gt;
      &amp;lt;link&amp;gt;http://mydomain/redirect.html?goto=$click.value2$&amp;lt;/link&amp;gt;
    &amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Dec 2015 00:26:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19158#M671</guid>
      <dc:creator>lionel319</dc:creator>
      <dc:date>2015-12-01T00:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19159#M672</link>
      <description>&lt;P&gt;I found the pipe n needed for it to work for me:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;use link tag&lt;/LI&gt;
&lt;LI&gt;$click.value2|n$
-note- pipe n prevents special character escaping&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 09 Jun 2017 14:50:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19159#M672</guid>
      <dc:creator>wschulze</dc:creator>
      <dc:date>2017-06-09T14:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19160#M673</link>
      <description>&lt;P&gt;@jhupka, you should click &lt;CODE&gt;Accept&lt;/CODE&gt; to award him karma.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 23:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19160#M673</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-01-07T23:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19161#M674</link>
      <description>&lt;P&gt;this worked for me. no JS required.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;condition field="URL"&amp;gt;
&amp;lt;link target="_blank"&amp;gt;$click.value2|n$&amp;lt;/link&amp;gt;
&amp;lt;/condition&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Mar 2019 15:42:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19161#M674</guid>
      <dc:creator>johnmvang</dc:creator>
      <dc:date>2019-03-05T15:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Drill down to absolute URL using click.value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19162#M675</link>
      <description>&lt;P&gt;How to achieve this if I want to navigate to a folder path&lt;BR /&gt;
Consider the result of splunk query&lt;BR /&gt;
Name| path&lt;BR /&gt;
Path1 | \abc\p1&lt;BR /&gt;
Path2 | \abc\p2&lt;/P&gt;

&lt;P&gt;I want to click and navigate to the paths .&lt;/P&gt;

&lt;P&gt;For weburls i can achieve using $click.value2|n$&lt;BR /&gt;
But in the case of folders and shared paths how to achieve this???&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 11:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Drill-down-to-absolute-URL-using-click-value/m-p/19162#M675</guid>
      <dc:creator>afsalkh</dc:creator>
      <dc:date>2020-03-12T11:08:11Z</dc:date>
    </item>
  </channel>
</rss>

