<?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: Search on data model object, weird behavior in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142095#M39380</link>
    <description>&lt;P&gt;Use single quote around the field to resolve error as mentioned in the comment. &lt;/P&gt;

&lt;P&gt;... | eval n = if('Probe.Class'==1, "true", "false") | ...&lt;/P&gt;

&lt;P&gt;I got my issue resolved using this.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2017 08:38:56 GMT</pubDate>
    <dc:creator>anchalsingh</dc:creator>
    <dc:date>2017-04-06T08:38:56Z</dc:date>
    <item>
      <title>Search on data model object, weird behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142093#M39378</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;i'm fairly new to Splunk and have a problem regarding searches on data models.&lt;BR /&gt;
So what i did is, i created a data model which introduces a new field to my events by an evaluation. Now i'm trying to search on this data and create reports. &lt;BR /&gt;
So what i'm doing in my searches looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| datamodel Probe CityProbe search | stats values(Probe.Class)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where "Class" is a field of type &lt;EM&gt;number&lt;/EM&gt; in the events of my data object. This works fine and it produces the different values that are in "Class".&lt;BR /&gt;
Now i'm trying to execute some if statements on this "Class" field, so i do something like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| datamodel Probe CityProbe search | eval n = if(Probe.Class==1, "true", "false") | stats values(n)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This fails with "Error in 'eval' command: Typechecking failed. The '==' operator received different types.". So i tried to find out of what type the "Probe.Class" field is and it turns out that it is NULL all the time. I don't get how this can be, since the first query, working on the same field, works.&lt;/P&gt;

&lt;P&gt;By the way, when i do this on the index itself, without the data model, it works.&lt;/P&gt;

&lt;P&gt;Can anyone please enlighten me on how this works?&lt;BR /&gt;
Thanks in advance&lt;/P&gt;

&lt;P&gt;Regards, Karsten&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2014 16:53:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142093#M39378</guid>
      <dc:creator>MemoreX42</dc:creator>
      <dc:date>2014-04-24T16:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search on data model object, weird behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142094#M39379</link>
      <description>&lt;P&gt;I had the same message and resolved it by single-quoting the fields inside the eval statement so the following might do the trick:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval n = if('Probe.Class'==1, "true", "false") | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Mar 2015 11:58:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142094#M39379</guid>
      <dc:creator>tpflicke</dc:creator>
      <dc:date>2015-03-24T11:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search on data model object, weird behavior</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142095#M39380</link>
      <description>&lt;P&gt;Use single quote around the field to resolve error as mentioned in the comment. &lt;/P&gt;

&lt;P&gt;... | eval n = if('Probe.Class'==1, "true", "false") | ...&lt;/P&gt;

&lt;P&gt;I got my issue resolved using this.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 08:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-on-data-model-object-weird-behavior/m-p/142095#M39380</guid>
      <dc:creator>anchalsingh</dc:creator>
      <dc:date>2017-04-06T08:38:56Z</dc:date>
    </item>
  </channel>
</rss>

