<?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: Simple XML: Dynamic variables/value in choice tag in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133480#M7903</link>
    <description>&lt;P&gt;did you find any solution? got the same problem &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 May 2014 09:59:50 GMT</pubDate>
    <dc:creator>tugnet</dc:creator>
    <dc:date>2014-05-20T09:59:50Z</dc:date>
    <item>
      <title>Simple XML: Dynamic variables/value in choice tag</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133479#M7902</link>
      <description>&lt;P&gt;hi,&lt;BR /&gt;
I'm building a simple xml form so that user can select via dropdown. I've got a situation where the "Metric" logic is different. I'm currently trying to put the logic as choice value, but it doesn't not accept dynamic value (eg $Report_Type$). Hence during search, it comes up as $Report_Type$ instead of "ReportA". Any way to overcome this issue?  (OR Any other method to set dynamic variable in simpleXML is also appreciated)&lt;/P&gt;

&lt;P&gt;Example below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;input type="radio" token="Report_Type" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select a Report:&amp;lt;/label&amp;gt;
          &amp;lt;default&amp;gt;ReportA&amp;lt;/default&amp;gt;

          &amp;lt;!-- Define the choices in code --&amp;gt;
          &amp;lt;choice value="ReportA"&amp;gt;ReportA&amp;lt;/choice&amp;gt;
          &amp;lt;choice value="ReportB"&amp;gt;ReportB&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;

    &amp;lt;input type="dropdown" token="Metric" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select a Metric:&amp;lt;/label&amp;gt;
          &amp;lt;default&amp;gt;Count&amp;lt;/default&amp;gt;    
          &amp;lt;choice value="stats sum(count) by Time_Bucket,$Report_Type$| rename sum(count) as Customer_COUNT "&amp;gt;Count&amp;lt;/choice&amp;gt;
          &amp;lt;choice value="eventstats max(count) as MAXVAL by $Report_Type$ | where (count=MAXVAL)| rename count as Customer_MAX_COUNT"&amp;gt;Peak&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;        

    &amp;lt;row&amp;gt;
    &amp;lt;table&amp;gt;
    &amp;lt;searchPostProcess&amp;gt;$Metric$ ... Some other calculation&amp;lt;/searchPostProcess&amp;gt;
      &amp;lt;option name="drilldown"&amp;gt;off&amp;lt;/option&amp;gt;
      &amp;lt;option name="showPager"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133479#M7902</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2020-09-28T16:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: Dynamic variables/value in choice tag</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133480#M7903</link>
      <description>&lt;P&gt;did you find any solution? got the same problem &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2014 09:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133480#M7903</guid>
      <dc:creator>tugnet</dc:creator>
      <dc:date>2014-05-20T09:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: Dynamic variables/value in choice tag</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133481#M7904</link>
      <description>&lt;P&gt;unfortunately, not. I had to switch to advanced XML (sidieviewutil) for this.&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2014 09:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133481#M7904</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2014-05-27T09:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: Dynamic variables/value in choice tag</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133482#M7905</link>
      <description>&lt;P&gt;Why not combine both choices into the same dropdown list and have 4 choices instead of 2 like: &lt;/P&gt;

&lt;P&gt;1- Count For ReportA&lt;/P&gt;

&lt;P&gt;2- Peak For Report A&lt;/P&gt;

&lt;P&gt;3- Count For Report B&lt;/P&gt;

&lt;P&gt;4- Peak For Report B&lt;/P&gt;

&lt;P&gt;You can also try troubleshooting to check if "report_Type" is actually taking the default value...try putin $Report_Type$ in a title or something just to make sure that you can read the choice you made...if you can't read the choice it's probably a problem with the radio button...try replacing it with a drowndown list if you want &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:43:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133482#M7905</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2020-09-28T16:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML: Dynamic variables/value in choice tag</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133483#M7906</link>
      <description>&lt;P&gt;Try something like this (run anywhere xml code)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;ReportType&amp;lt;/label&amp;gt;
  &amp;lt;fieldset&amp;gt;
    &amp;lt;input type="radio" token="varIndex" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select an Index:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;_internal&amp;lt;/default&amp;gt;
      &amp;lt;!-- Define the choices in code --&amp;gt;
      &amp;lt;choice value="_internal"&amp;gt;_internal&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="main"&amp;gt;main&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="Metric" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select a Metric:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;Count&amp;lt;/default&amp;gt;
      &amp;lt;populatingSearch fieldForLabel="key"  fieldForValue="value" &amp;gt;
        index="$varIndex$" | stats count as value | eval key="Count" | append [search index="$varIndex$" | stats count by date_mday | stats max(count) as value | eval key="Peak"]
      &amp;lt;/populatingSearch&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;table&amp;gt;
      &amp;lt;title&amp;gt;Log events&amp;lt;/title&amp;gt;
      &amp;lt;searchString&amp;gt;|stats count  | eval Metric="$Metric$" | table Metric&amp;lt;/searchString&amp;gt;
      &amp;lt;earliestTime&amp;gt;-1d&amp;lt;/earliestTime&amp;gt;
      &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;     
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;table&amp;gt;
      &amp;lt;title&amp;gt;Dropdown query&amp;lt;/title&amp;gt;
      &amp;lt;searchString&amp;gt;index="$varIndex$" | stats count as value | eval key="Count" | append [search index="$varIndex$" | stats count by date_mday | stats max(count) as value | eval key="Peak"]&amp;lt;/searchString&amp;gt;
      &amp;lt;earliestTime&amp;gt;-1d&amp;lt;/earliestTime&amp;gt;
      &amp;lt;latestTime&amp;gt;now&amp;lt;/latestTime&amp;gt;     
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 May 2014 13:05:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Simple-XML-Dynamic-variables-value-in-choice-tag/m-p/133483#M7906</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-27T13:05:50Z</dc:date>
    </item>
  </channel>
</rss>

