<?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: Dashboard Input Accepting Either Hex or Decimal Number in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152604#M9315</link>
    <description>&lt;P&gt;Try something like this (run anywhere sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Test&amp;lt;/label&amp;gt;
  &amp;lt;description/&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="inputtype" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Input Type&amp;lt;/label&amp;gt;
      &amp;lt;choice value="hex"&amp;gt;HEX&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="decimal"&amp;gt;DECIMAL&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;hex&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="input"&amp;gt;
      &amp;lt;label&amp;gt;Input&amp;lt;/label&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;title&amp;gt;Output&amp;lt;/title&amp;gt;
        &amp;lt;searchString&amp;gt;| gentimes start=-1 | eval Input="$input$" | eval Output=if("$inputtype$"="hex","$input$", replace(tostring("".tostring($input$, "hex").""),"x","")) | table Input Output&amp;lt;/searchString&amp;gt;
        &amp;lt;earliestTime&amp;gt;0&amp;lt;/earliestTime&amp;gt;
        &amp;lt;latestTime/&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="count"&amp;gt;10&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>Fri, 27 Feb 2015 22:51:30 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-02-27T22:51:30Z</dc:date>
    <item>
      <title>Dashboard Input Accepting Either Hex or Decimal Number</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152603#M9314</link>
      <description>&lt;P&gt;Hi all, I'm going a little crazy with macros trying to get this to work, and I was hoping for some pointers. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I have a dashboard with a working form input for a customer ID, and I'd like to generalize the dashboard to take the customer ID in either hex or decimal. Right now, I can get one or the other working but not both.&lt;/P&gt;

&lt;P&gt;My approach was to create 2 form inputs: one dropdown for HEX/DEC and one text field for the customer ID. The end format for the search is as follows where &lt;CODE&gt;$convID$&lt;/CODE&gt; represents &lt;STRONG&gt;either&lt;/STRONG&gt; the HEX or DEC value:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=x [search sourcetype=x custID=CASE($convID$) | fields transID] | transaction transID&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The idea here is to get a list of transactions with the custID and then re-search using transaction command in order to get the Request and Response parts of the transaction. As you probably have guessed, the custID only shows up in the Request portion so a base search for &lt;CODE&gt;custID=xxx&lt;/CODE&gt; would not work. Also, the custID is always in HEX in the raw log file.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Long story short, I can't seem to use the token value of 1 input field for the token value of a different input&lt;/STRONG&gt;. I was thinking I'd set the HEX/DEC input to use &lt;CODE&gt;$custID$&lt;/CODE&gt; for the HEX value and &lt;CODE&gt;my_to_hex($custID$)&lt;/CODE&gt; (as a macro with backticks) for the value of DEC. That way, the text input field exists only to power the HEX/DEC input and the token from that input actually goes into the search (as &lt;CODE&gt;$convID$&lt;/CODE&gt; in the final search above).&lt;/P&gt;

&lt;P&gt;My "to hex" macro is: &lt;CODE&gt;replace(tostring("".tostring($subid$, "hex").""),"x","")&lt;/CODE&gt; which I couldn't seem to simplify even though it looks ugly.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2015 19:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152603#M9314</guid>
      <dc:creator>RMartinezDTV</dc:creator>
      <dc:date>2015-02-27T19:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Input Accepting Either Hex or Decimal Number</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152604#M9315</link>
      <description>&lt;P&gt;Try something like this (run anywhere sample)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Test&amp;lt;/label&amp;gt;
  &amp;lt;description/&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="inputtype" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Input Type&amp;lt;/label&amp;gt;
      &amp;lt;choice value="hex"&amp;gt;HEX&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="decimal"&amp;gt;DECIMAL&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;hex&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="input"&amp;gt;
      &amp;lt;label&amp;gt;Input&amp;lt;/label&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;title&amp;gt;Output&amp;lt;/title&amp;gt;
        &amp;lt;searchString&amp;gt;| gentimes start=-1 | eval Input="$input$" | eval Output=if("$inputtype$"="hex","$input$", replace(tostring("".tostring($input$, "hex").""),"x","")) | table Input Output&amp;lt;/searchString&amp;gt;
        &amp;lt;earliestTime&amp;gt;0&amp;lt;/earliestTime&amp;gt;
        &amp;lt;latestTime/&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="count"&amp;gt;10&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>Fri, 27 Feb 2015 22:51:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152604#M9315</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-02-27T22:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Input Accepting Either Hex or Decimal Number</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152605#M9316</link>
      <description>&lt;P&gt;This example works standalone but I've had a heck of a time integrating it. The general problem is that I need the "Output" (converted) value to be present in the original search string (sourcetype=xx custID=Output), and placing the eval prior to the initial search command doesn't work. Trying to resolve it in-line (e.g. custID=if($inputtype$....) doesn't work either syntactically.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2015 23:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Input-Accepting-Either-Hex-or-Decimal-Number/m-p/152605#M9316</guid>
      <dc:creator>RMartinezDTV</dc:creator>
      <dc:date>2015-03-05T23:34:17Z</dc:date>
    </item>
  </channel>
</rss>

