<?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 do I do addition in a Splunk HTML form? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397930#M26050</link>
    <description>&lt;P&gt;You can always hide any panel or table by using depends="$hidden$", for eg:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;table depends="$hidden$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will hide the table from displaying.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Oct 2018 20:52:55 GMT</pubDate>
    <dc:creator>Vijeta</dc:creator>
    <dc:date>2018-10-02T20:52:55Z</dc:date>
    <item>
      <title>How do I do addition in a Splunk HTML form?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397927#M26047</link>
      <description>&lt;P&gt;How do I evaluate $a$ + $b$? Or even just evaluate 1+2?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
    &amp;lt;panel&amp;gt;
        &amp;lt;html&amp;gt;
            &amp;lt;ul&amp;gt;
                &amp;lt;li&amp;gt;
                    &amp;lt;p&amp;gt;Ram Per Server: $a$ + $b$&amp;lt;/p&amp;gt;
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/html&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, 02 Oct 2018 19:01:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397927#M26047</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-10-02T19:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do addition in a Splunk HTML form?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397928#M26048</link>
      <description>&lt;P&gt;I don't think you can directly do calculation in HTML, for your requirement can't you do calculation in splunk query and use the result token in html?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 19:16:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397928#M26048</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-02T19:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do addition in a Splunk HTML form?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397929#M26049</link>
      <description>&lt;P&gt;Yes! Thanks. I'm not sure if it's the best way or not, and am definitely open to hearing other answers/modifications. This is what I did:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;panel&amp;gt;
        &amp;lt;search&amp;gt;
            &amp;lt;query&amp;gt;
| makeresults | eval baz=$a$+$b$| table baz
            &amp;lt;/query&amp;gt;
            &amp;lt;preview&amp;gt;
                &amp;lt;set token="baz"&amp;gt;$result.baz$&amp;lt;/set&amp;gt;
            &amp;lt;/preview&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;html&amp;gt;
            &amp;lt;p&amp;gt;&amp;lt;b&amp;gt;section title&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;
            &amp;lt;ul&amp;gt;     
                &amp;lt;li&amp;gt;
                    &amp;lt;p&amp;gt;field: &amp;lt;a&amp;gt;$baz$&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
                &amp;lt;/li&amp;gt;
            &amp;lt;/ul&amp;gt;
        &amp;lt;/html&amp;gt;
     &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Oct 2018 20:49:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397929#M26049</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-10-02T20:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do addition in a Splunk HTML form?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397930#M26050</link>
      <description>&lt;P&gt;You can always hide any panel or table by using depends="$hidden$", for eg:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;table depends="$hidden$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;will hide the table from displaying.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 20:52:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397930#M26050</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2018-10-02T20:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do addition in a Splunk HTML form?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397931#M26051</link>
      <description>&lt;P&gt;Thanks once more. For anyone else looking for the answer on this page, @vijeta's comment above references my code before I edited it, where previously I had the query run in a table and was looking for a way to hide it.&lt;/P&gt;

&lt;P&gt;Thus, there are two ways of accomplishing the answer to this question: run the query in a table and hide it, or just put your query in the same panel as the html form like I did in my edited comment.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 21:08:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397931#M26051</guid>
      <dc:creator>nick405060</dc:creator>
      <dc:date>2018-10-02T21:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I do addition in a Splunk HTML form?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397932#M26052</link>
      <description>&lt;P&gt;You can do that in SimpleXML using . Where to place the  depends on where your tokens come from. In case they come from an input:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Dashboard&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="text" token="tok_mem"&amp;gt;
      &amp;lt;label&amp;gt;Memory&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="tok_sum"&amp;gt;$tok_mem$ + $tok_swap$&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="tok_swap"&amp;gt;
      &amp;lt;label&amp;gt;Swap&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="tok_sum"&amp;gt;$tok_mem$ + $tok_swap$&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;html&amp;gt;
             &amp;lt;ul&amp;gt;
                 &amp;lt;li&amp;gt;
                     &amp;lt;p&amp;gt;Ram Per Server: $tok_sum$&amp;lt;/p&amp;gt;
                 &amp;lt;/li&amp;gt;
             &amp;lt;/ul&amp;gt;
         &amp;lt;/html&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;You could do that on Search  as well, ... see &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.2.0/Viz/tokens"&gt;Splunk&amp;gt;docs on token usage&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 01:17:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-do-I-do-addition-in-a-Splunk-HTML-form/m-p/397932#M26052</guid>
      <dc:creator>back2root</dc:creator>
      <dc:date>2018-10-04T01:17:41Z</dc:date>
    </item>
  </channel>
</rss>

