<?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: pass quotes inside of tokens for dashboard in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378893#M24804</link>
    <description>&lt;P&gt;Hi Kamlesh , &lt;BR /&gt;
I had the same problem,  was trying the solution provided by you here.&lt;BR /&gt;
I could see only first occurence is getting replaced. &lt;BR /&gt;
Can Please you help me here&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 04:16:12 GMT</pubDate>
    <dc:creator>vasanthi77</dc:creator>
    <dc:date>2019-06-28T04:16:12Z</dc:date>
    <item>
      <title>pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378886#M24797</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm looking to pass a token in a dashboard where the value may have quotes, since the token is going into an eval, anyone know how to get that to work? Right now i'm running into eval malformed errors. with quadruple quotes or more depending on how many quotes the user inputs.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 17:49:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378886#M24797</guid>
      <dc:creator>johnmvang</dc:creator>
      <dc:date>2018-11-07T17:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378887#M24798</link>
      <description>&lt;P&gt;Can you post some example values for tokens and the code which is giving error&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 21:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378887#M24798</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-11-26T21:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378888#M24799</link>
      <description>&lt;P&gt;sure,&lt;/P&gt;

&lt;P&gt;i've got a dashboard, where users can fill out 3 forms:&lt;/P&gt;

&lt;P&gt;they can input:&lt;/P&gt;

&lt;P&gt;'My Title' for input1 - which is a title input.&lt;BR /&gt;
index="my_index" sourcetype="my_sourcetype" my_search - for the search&lt;BR /&gt;
then choose a dropdown.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;panel depends="$show_row2_tok$,$show_r2panel2_tok$"&amp;gt;
      &amp;lt;title&amp;gt;Row 2 - Panel 2&amp;lt;/title&amp;gt;
      &amp;lt;input type="text" token="r2p2_title"&amp;gt;
        &amp;lt;label&amp;gt;Panel Title&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="r2p2_search"&amp;gt;
        &amp;lt;label&amp;gt;Search String&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="dropdown" token="r2p2_viz"&amp;gt;
        &amp;lt;label&amp;gt;Visualization Type&amp;lt;/label&amp;gt;
        &amp;lt;choice value="column"&amp;gt;Column Chart&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="line"&amp;gt;Line Graph&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="stats"&amp;gt;Stats Table&amp;lt;/choice&amp;gt;
        &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;html&amp;gt;

    &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;These will then populate values in a KVstore where i need to write them with an eval:&lt;/P&gt;

&lt;P&gt;| makeresults&lt;BR /&gt;
| eval custom_r2p2_title = "$write_r2p2_title$"&lt;BR /&gt;
| eval custom_r2p2_search = "$write_r2p2_search$"&lt;BR /&gt;
| eval custom_r2p2_vi = "$write_r2p2_viz$"&lt;BR /&gt;
| outputlookup my_kvstore append=true&lt;/P&gt;

&lt;P&gt;since i'm enabling users to add a search string into the second input, sometimes they will have quotes inside of their values which will break the search with this error:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Error in 'eval' command: The expression is malformed.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:07:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378888#M24799</guid>
      <dc:creator>johnmvang</dc:creator>
      <dc:date>2020-09-29T22:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378889#M24800</link>
      <description>&lt;P&gt;this all works as long as there are no quotes. just fyi.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 22:18:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378889#M24800</guid>
      <dc:creator>johnmvang</dc:creator>
      <dc:date>2018-11-26T22:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378890#M24801</link>
      <description>&lt;P&gt;@johnmvang&lt;BR /&gt;
You can escape quote by replacing &lt;CODE&gt;"&lt;/CODE&gt; to &lt;CODE&gt;\"&lt;/CODE&gt; on change of input. Just try to insert  &lt;CODE&gt;"ABC"&lt;/CODE&gt; in below provided sample dashboard XML.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Quotes&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="text" token="field1"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="txtValue"&amp;gt;replace('value',"\"","\\\"")&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;
        $txtValue$
      &amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| stats count | eval A="$txtValue$"&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;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Nov 2018 12:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378890#M24801</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-11-27T12:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378891#M24802</link>
      <description>&lt;P&gt;Hi Kamlesh, that did it for me. Thanks works great.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 14:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378891#M24802</guid>
      <dc:creator>johnmvang</dc:creator>
      <dc:date>2018-11-28T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378892#M24803</link>
      <description>&lt;P&gt;Glad to help you @johnmvang&lt;BR /&gt;
Can you please accept the answer to help the community? &lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 16:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378892#M24803</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-11-28T16:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: pass quotes inside of tokens for dashboard</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378893#M24804</link>
      <description>&lt;P&gt;Hi Kamlesh , &lt;BR /&gt;
I had the same problem,  was trying the solution provided by you here.&lt;BR /&gt;
I could see only first occurence is getting replaced. &lt;BR /&gt;
Can Please you help me here&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 04:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/pass-quotes-inside-of-tokens-for-dashboard/m-p/378893#M24804</guid>
      <dc:creator>vasanthi77</dc:creator>
      <dc:date>2019-06-28T04:16:12Z</dc:date>
    </item>
  </channel>
</rss>

