<?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: How to clear/reset the value of a token? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/601213#M49379</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231990"&gt;@Mario&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;in the input section, you could add a panel like this (obviously to adapt to your tokes:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;input type="radio" token="resetTokens" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;choice value="reset"&amp;gt;Reset Inputs&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="retain"&amp;gt;Retain&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;retain&amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="reset"&amp;gt;
          &amp;lt;unset token="token1"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;unset token="token2"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;unset token="token3"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;set token="resetTokens"&amp;gt;retain&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 15:01:34 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-06-09T15:01:34Z</dc:date>
    <item>
      <title>How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/601208#M49378</link>
      <description>&lt;P&gt;Hello all.&lt;/P&gt;
&lt;P&gt;I am making a dashboard in which I was in the need to create a&amp;nbsp; subsearch.&amp;nbsp; This is the piece of code that does it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;random panel title&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;table depends="$show_debug$"&amp;gt;&lt;BR /&gt;&amp;lt;search id="Build_list"&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;index= here it goes my query |fields * |table important_field &lt;STRONG&gt;|format&lt;/STRONG&gt;&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;finalized&amp;gt;&lt;BR /&gt;&amp;lt;condition match=" 'job.resultCount' != 0"&amp;gt;&lt;BR /&gt;&amp;lt;set token="my_list"&amp;gt;$result.search$&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;condition&amp;gt;&lt;BR /&gt;&amp;lt;unset token="my_list"&amp;gt;&amp;lt;/unset&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/finalized&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/table&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;BR /&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;another panel&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;html depends="$show_debug$"&amp;gt;&lt;BR /&gt;&amp;lt;h3&amp;gt;$my_list$&amp;lt;/h3&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and here I am using the $my_list$ token:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;$my_list$ | foreach&lt;BR /&gt;something.* [rename "&amp;amp;lt;&amp;amp;lt;FIELD&amp;amp;gt;&amp;amp;gt;" as&lt;BR /&gt;"&amp;amp;lt;&amp;amp;lt;MATCHSEG1&amp;amp;gt;&amp;amp;gt;"]&lt;BR /&gt;| stats&lt;BR /&gt;values(Url),values(UrlDomain)&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;$earliest$&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;$latest$&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This worked well the first time,&amp;nbsp; but now,&amp;nbsp; for every new query I do, no matter if I close and open a new browser/splunk session,&amp;nbsp; I see still the results of the first query I did.&amp;nbsp; is like&amp;nbsp; $my_list$ has the first ever values hardened and I cannot reset them.&amp;nbsp; I though that&amp;nbsp;&amp;lt;unset token="my_list"&amp;gt;&amp;lt;/unset&amp;gt; would clear it but not....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help please?&amp;nbsp; The goal here is to use this $my_list$ token, which is a splunk query&amp;nbsp; (note the |format at the end of the query)&amp;nbsp; but of course this token needs to be empty every time I run a new query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot in advance.&lt;/P&gt;
&lt;P&gt;Mario&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 14:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/601208#M49378</guid>
      <dc:creator>Mario</dc:creator>
      <dc:date>2022-06-09T14:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/601213#M49379</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231990"&gt;@Mario&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;in the input section, you could add a panel like this (obviously to adapt to your tokes:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;input type="radio" token="resetTokens" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;choice value="reset"&amp;gt;Reset Inputs&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="retain"&amp;gt;Retain&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;retain&amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="reset"&amp;gt;
          &amp;lt;unset token="token1"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;unset token="token2"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;unset token="token3"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;set token="resetTokens"&amp;gt;retain&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 15:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/601213#M49379</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-09T15:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/641328#M52359</link>
      <description>&lt;P&gt;how would I do this with a *link* field type? I just want a button that says 'SUBMIT" so the user can reset the tokens.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 18:04:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/641328#M52359</guid>
      <dc:creator>makelovenotwar</dc:creator>
      <dc:date>2023-04-25T18:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/641386#M52368</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256188"&gt;@makelovenotwar&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you can do this using a JavaScript, but I'm not an expert in JS so I cannot help you more.&lt;/P&gt;&lt;P&gt;But using my solution, you have a reset button in the header bar.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 06:48:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/641386#M52368</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-04-26T06:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/641388#M52369</link>
      <description>&lt;P&gt;Ciao Beppe!&lt;/P&gt;&lt;P&gt;I am so sorry I thought I marked your reply as solution before. I have just done it now.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Grazie mille!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 07:05:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/641388#M52369</guid>
      <dc:creator>Mario</dc:creator>
      <dc:date>2023-04-26T07:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/689306#M56464</link>
      <description>&lt;P&gt;This solution is for classic dashboard. How do it in Dashboard studio ?&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2024 08:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/689306#M56464</guid>
      <dc:creator>kukasky</dc:creator>
      <dc:date>2024-06-02T08:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/689313#M56465</link>
      <description>&lt;P&gt;You need to use another search to (conditionally) set the result field to null and use the results tokens from the search. For example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "visualizations": {
        "viz_F0Z9jsFU": {
            "type": "splunk.singlevalue",
            "title": "Speed in km/h",
            "dataSources": {
                "primary": "ds_eZ6LtdAT"
            },
            "options": {
                "unit": "km/h"
            }
        },
        "viz_p4tcz9dd": {
            "type": "splunk.singlevalue",
            "dataSources": {
                "primary": "ds_RopRdHUj"
            },
            "title": "Speed in mph",
            "options": {
                "unit": "mph"
            },
            "description": "$km per hour : result.kmh$ * 0.621"
        }
    },
    "dataSources": {
        "ds_eZ6LtdAT": {
            "type": "ds.search",
            "options": {
                "query": "| makeresults\n| eval kmh=random()%100",
                "enableSmartSources": true
            },
            "name": "km per hour"
        },
        "ds_RopRdHUj": {
            "type": "ds.search",
            "options": {
                "query": "| makeresults\n| eval speed_in_mph = if($km per hour:result.kmh$ &amp;gt; 50, $km per hour:result.kmh$ * 0.621, null())\n| table speed_in_mph"
            },
            "name": "kmh to mph"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "latest": "$global_time.latest$",
                        "earliest": "$global_time.earliest$"
                    }
                }
            }
        }
    },
    "inputs": {
        "input_global_trp": {
            "type": "input.timerange",
            "options": {
                "token": "global_time",
                "defaultValue": "-24h@h,now"
            },
            "title": "Global Time Range"
        }
    },
    "layout": {
        "type": "absolute",
        "options": {
            "width": 1440,
            "height": 960,
            "display": "auto"
        },
        "structure": [
            {
                "item": "viz_F0Z9jsFU",
                "type": "block",
                "position": {
                    "x": 10,
                    "y": 10,
                    "w": 250,
                    "h": 250
                }
            },
            {
                "item": "viz_p4tcz9dd",
                "type": "block",
                "position": {
                    "x": 290,
                    "y": 10,
                    "w": 250,
                    "h": 250
                }
            }
        ],
        "globalInputs": [
            "input_global_trp"
        ]
    },
    "description": "",
    "title": "Evaluate tokens using search"
}&lt;/LI-CODE&gt;&lt;P&gt;Adapted from documentation example&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/9.1.2312/DashStudio/searchTokens#Source_code_example_2" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2024 09:40:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/689313#M56465</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-02T09:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/701787#M57551</link>
      <description>&lt;P&gt;Hi Giuseppe!&lt;/P&gt;&lt;P&gt;It's very useful, but this soluton needs to restart the search.&lt;/P&gt;&lt;P&gt;My needing is that one panel is related via token to another: when I click on a field in the second panel the previous show only related record. How can I reset the token in order to have all the records in the first panel without restart the search?&lt;/P&gt;&lt;P&gt;Thanks a lot!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 10:00:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/701787#M57551</guid>
      <dc:creator>maspiro</dc:creator>
      <dc:date>2024-10-14T10:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/701789#M57552</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223021"&gt;@maspiro&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;for my knowledge, restarting the search is the only way to reset a token.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 10:03:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/701789#M57552</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-10-14T10:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to clear/reset the value of a token?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/701794#M57553</link>
      <description>&lt;P&gt;Extending a previously answered question is perhaps not the best way of getting your question answered, particularly when the extension is a bit vague. Please start a new question with more specifics about your particular usecase and the difficulties you are having i.e. what would you want the solution to look like.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 10:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-clear-reset-the-value-of-a-token/m-p/701794#M57553</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-10-14T10:34:53Z</dc:date>
    </item>
  </channel>
</rss>

