<?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: can we pass token values from a dashboard as parameters to python script being used as a data input ? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/can-we-pass-token-values-from-a-dashboard-as-parameters-to/m-p/450028#M45451</link>
    <description>&lt;P&gt;Hi @aayushisplunk1,&lt;/P&gt;

&lt;P&gt;There is no clean way to do this, but it can be done as follows.&lt;/P&gt;

&lt;P&gt;First of all you will need to define a custom search command that allows you to modify the specific script under &lt;CODE&gt;bin&lt;/CODE&gt; in your app with the token parameter. Let's call this command "passValue" and make it take one parameter. So to call your script you would call it like this : &lt;CODE&gt;| passValue value&lt;/CODE&gt;&lt;BR /&gt;
See here for creating custom search commands :&lt;A href="http://dev.splunk.com/view/SP-CAAAFFT"&gt;http://dev.splunk.com/view/SP-CAAAFFT&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Once you got that custom command ready. You can easily make the dashboard you mentioned in your question using this logic :&lt;/P&gt;

&lt;P&gt;1- User selects token.&lt;BR /&gt;
2- User hits submit.&lt;BR /&gt;
3- One of the panels contains the &lt;CODE&gt;| passValue $value$&lt;/CODE&gt; command with the token. So once the submit button is hit, the script will do it's charm and modify your scripted inputs.&lt;BR /&gt;
4- Next time the scripted inputs run, it will use the new script with the modified value from the token.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David &lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2019 08:08:06 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2019-08-14T08:08:06Z</dc:date>
    <item>
      <title>can we pass token values from a dashboard as parameters to python script being used as a data input ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/can-we-pass-token-values-from-a-dashboard-as-parameters-to/m-p/450027#M45450</link>
      <description>&lt;P&gt;i have added an input as a drop down in a dashboard. I want to use the token value for the selected item from the drop down to be passed a parameter to a python script , which i have added as a local script from the "Add Inputs" option. &lt;BR /&gt;
Is it possible to pass tokens as parameters to the python script (being used as a data input) ?&lt;BR /&gt;
If yes, how can we do that ?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 07:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/can-we-pass-token-values-from-a-dashboard-as-parameters-to/m-p/450027#M45450</guid>
      <dc:creator>aayushisplunk1</dc:creator>
      <dc:date>2019-08-14T07:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: can we pass token values from a dashboard as parameters to python script being used as a data input ?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/can-we-pass-token-values-from-a-dashboard-as-parameters-to/m-p/450028#M45451</link>
      <description>&lt;P&gt;Hi @aayushisplunk1,&lt;/P&gt;

&lt;P&gt;There is no clean way to do this, but it can be done as follows.&lt;/P&gt;

&lt;P&gt;First of all you will need to define a custom search command that allows you to modify the specific script under &lt;CODE&gt;bin&lt;/CODE&gt; in your app with the token parameter. Let's call this command "passValue" and make it take one parameter. So to call your script you would call it like this : &lt;CODE&gt;| passValue value&lt;/CODE&gt;&lt;BR /&gt;
See here for creating custom search commands :&lt;A href="http://dev.splunk.com/view/SP-CAAAFFT"&gt;http://dev.splunk.com/view/SP-CAAAFFT&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Once you got that custom command ready. You can easily make the dashboard you mentioned in your question using this logic :&lt;/P&gt;

&lt;P&gt;1- User selects token.&lt;BR /&gt;
2- User hits submit.&lt;BR /&gt;
3- One of the panels contains the &lt;CODE&gt;| passValue $value$&lt;/CODE&gt; command with the token. So once the submit button is hit, the script will do it's charm and modify your scripted inputs.&lt;BR /&gt;
4- Next time the scripted inputs run, it will use the new script with the modified value from the token.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David &lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 08:08:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/can-we-pass-token-values-from-a-dashboard-as-parameters-to/m-p/450028#M45451</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-08-14T08:08:06Z</dc:date>
    </item>
  </channel>
</rss>

