<?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 pass an eval string as a token in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454120#M29791</link>
    <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;test_splunkanswers&amp;lt;/label&amp;gt;
  &amp;lt;fieldset&amp;gt;
    &amp;lt;input type="text" token="mytoken" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;mytoken&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;case(dow=="Mon","dow_Mtwtfss",true(),"dow_mTWTFSS")&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;case(dow=="Mon","dow_Mtwtfss",true(),"dow_mTWTFSS")&amp;lt;/initialValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|makeresults| eval mytokenoutput=$mytoken$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i removed all of the escaped double quotes and the double quotes around the string, because you want it to actually eval this in the end, and not treat it as a string. &lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2019 01:48:31 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2019-03-22T01:48:31Z</dc:date>
    <item>
      <title>How to pass an eval string as a token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454119#M29790</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;I am trying to populate an input text box with an eval case statement - not using the function but simply placing the text for the eval statement in to the text box by using a token. This gets saved in a lookup file and then read using inputlookup to populate the text box with the value in my dash. &lt;/P&gt;

&lt;P&gt;EG &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="mytoken" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;mytoken&amp;lt;/label&amp;gt;
  &amp;lt;default&amp;gt;"case(dow==\"Mon\",\"dow_Mtwtfss\",true(),\"dow_mTWTFSS\")"&amp;lt;/default&amp;gt;
  &amp;lt;initialValue&amp;gt;"case(dow==\"Mon\",\"dow_Mtwtfss\",true(),\"dow_mTWTFSS\")"&amp;lt;/initialValue&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;| eval mytokenoutput="$mytoken$"&lt;BR /&gt;
  |outputlookup bla.csv&lt;/P&gt;

&lt;P&gt;The inputlookup command then reads the lookup file token and places that token in the text box - but not if i use "case".&lt;/P&gt;

&lt;P&gt;So I have escaped the the case statement to just input the string, but it still doesnt work. If i just put normal text in there  - it works. If i do all of this in a search scenario rather than token/dashboard scenario it also works. &lt;/P&gt;

&lt;P&gt;Any thoughts ?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 19:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454119#M29790</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2019-03-21T19:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass an eval string as a token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454120#M29791</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;test_splunkanswers&amp;lt;/label&amp;gt;
  &amp;lt;fieldset&amp;gt;
    &amp;lt;input type="text" token="mytoken" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;mytoken&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;case(dow=="Mon","dow_Mtwtfss",true(),"dow_mTWTFSS")&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;case(dow=="Mon","dow_Mtwtfss",true(),"dow_mTWTFSS")&amp;lt;/initialValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|makeresults| eval mytokenoutput=$mytoken$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i removed all of the escaped double quotes and the double quotes around the string, because you want it to actually eval this in the end, and not treat it as a string. &lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 01:48:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454120#M29791</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2019-03-22T01:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass an eval string as a token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454121#M29792</link>
      <description>&lt;P&gt;@cmerriman thanks for getting back to me! The problem is that if I dont escape everything it will not dump it all to the csv file which kinda breaks my dashboard.. Escaping everything works but doesnt make a good default/initial value because obviously it wouldnt run the case statement first time round. &lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 10:10:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-pass-an-eval-string-as-a-token/m-p/454121#M29792</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2019-03-25T10:10:59Z</dc:date>
    </item>
  </channel>
</rss>

