<?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 can I use a string value to compare number? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200220#M58037</link>
    <description>&lt;P&gt;How about a big case statement which writes an expression for every possible operator (should be a finite list), like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search with fields Threshold, Value, Operator 
| eval isBreached=case(Operator="&amp;gt;" AND Value&amp;gt;Threshold, "Yes", Operator="!=" AND Value!=Threshold,"Yes", Operator="&amp;lt;" AND Value&amp;lt;Threshold,"Yes", true(),"No") | rest of the search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Dec 2016 19:06:40 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-12-15T19:06:40Z</dc:date>
    <item>
      <title>how can I use a string value to compare number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200219#M58036</link>
      <description>&lt;P&gt;I have a field with values &amp;gt; = != etc., and another field that determines threshold&lt;BR /&gt;
Now I want to Compare the value of third field against the threshold field using the value of that (String) operator. How to achieve this?&lt;/P&gt;

&lt;P&gt;for example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Threshold (Num)|Value(Num)|Operator(String)
10|12|"&amp;gt;"
10|7|"!="
10|4|"&amp;lt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to compare the values using respective operator values and determine if the threshold is breached.&lt;BR /&gt;
Any clue?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 18:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200219#M58036</guid>
      <dc:creator>pramit46</dc:creator>
      <dc:date>2016-12-15T18:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: how can I use a string value to compare number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200220#M58037</link>
      <description>&lt;P&gt;How about a big case statement which writes an expression for every possible operator (should be a finite list), like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search with fields Threshold, Value, Operator 
| eval isBreached=case(Operator="&amp;gt;" AND Value&amp;gt;Threshold, "Yes", Operator="!=" AND Value!=Threshold,"Yes", Operator="&amp;lt;" AND Value&amp;lt;Threshold,"Yes", true(),"No") | rest of the search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 19:06:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200220#M58037</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-15T19:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: how can I use a string value to compare number?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200221#M58038</link>
      <description>&lt;P&gt;Awesome. Thanks a million @somesoni2. This helps a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Really Appreciate this. &lt;/P&gt;</description>
      <pubDate>Sun, 18 Dec 2016 05:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-can-I-use-a-string-value-to-compare-number/m-p/200221#M58038</guid>
      <dc:creator>pramit46</dc:creator>
      <dc:date>2016-12-18T05:45:48Z</dc:date>
    </item>
  </channel>
</rss>

