<?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: conditional eval ResultsValueSetter in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90612#M6014</link>
    <description>&lt;P&gt;Now I understand the meaning of your workaround, many thanks !&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2013 16:01:21 GMT</pubDate>
    <dc:creator>sbsbb</dc:creator>
    <dc:date>2013-04-15T16:01:21Z</dc:date>
    <item>
      <title>conditional eval ResultsValueSetter</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90607#M6009</link>
      <description>&lt;P&gt;I'm trying to do this&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;You can do this using conditional eval command in the search language to&lt;BR /&gt;
create one of N different search&lt;BR /&gt;
language strings, and then a&lt;BR /&gt;
ResultsValueSetter to pull down that&lt;BR /&gt;
string-valued field, and plug it into&lt;BR /&gt;
your search using another Search&lt;BR /&gt;
module.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I've my main search, and a table&lt;BR /&gt;
From that table I make a postprocess to build a $varSearch$ with the search String&lt;/P&gt;

&lt;P&gt;My Problem is my postprocess seems not to work as desired :&lt;BR /&gt;
eval varSearch=case($row.fields.H_message_type$=="test","AA",H_message_type=="Ctest","ZZ")&lt;/P&gt;

&lt;P&gt;This gives no results, so I'm not able to use it i the underlying search... ?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:42:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90607#M6009</guid>
      <dc:creator>sbsbb</dc:creator>
      <dc:date>2020-09-28T13:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: conditional eval ResultsValueSetter</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90608#M6010</link>
      <description>&lt;P&gt;OK.  This can work,  you just have to see the search expression from splunk's perspective after the $foo$ token gets filled in. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval varSearch=case($row.fields.H_message_type$=="test","AA",H_message_type=="Ctest","ZZ")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;will go up as &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval varSearch=case(test=="test","AA",H_message_type=="Ctest","ZZ")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This is testing for when the value of the &lt;EM&gt;test field&lt;/EM&gt; is equal to the string test.  Change it to &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval varSearch=case("$row.fields.H_message_type$"=="test","AA",H_message_type=="Ctest","ZZ")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and what you'll be sending to splunk will look like:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;eval varSearch=case("test"=="test","AA",H_message_type=="Ctest","ZZ")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Splunk may raise an eyebrow at your silly behaviour, but it will evaluate the condition to true at least.  It's a strange trick but not an uncommon one when all you need is a &lt;EM&gt;little&lt;/EM&gt; conditional help from the search language. &lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 17:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90608#M6010</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-04-11T17:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: conditional eval ResultsValueSetter</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90609#M6011</link>
      <description>&lt;P&gt;thanks for that.&lt;BR /&gt;
I have still the problem that a "search eval..." return no row, how can I change this ?&lt;/P&gt;

&lt;P&gt;In fact, it is probably the same, as when I want to make an spath on a $foo$ variable, I don't know either how to do it !&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 04:58:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90609#M6011</guid>
      <dc:creator>sbsbb</dc:creator>
      <dc:date>2013-04-12T04:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: conditional eval ResultsValueSetter</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90610#M6012</link>
      <description>&lt;P&gt;eval is a command, so there has to be a "|" character in front of it.  Can you clarify what you mean by "search eval.." It sounds like you're using the search command, which will simply search for these strings and thus return no results.&lt;/P&gt;

&lt;P&gt;try this: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| stats count | fields - count | eval varSearch=case("$row.fields.H_message_type$"=="test","AA",H_message_type=="Ctest","ZZ")&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;it looks bizarre because it is.   &lt;CODE&gt;| stats count&lt;/CODE&gt; creates one row with a 'count' field equal to 0.   the fields clause then removes the count field leaving a row and thus a blank slate for your eval...&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 05:01:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90610#M6012</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-04-12T05:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: conditional eval ResultsValueSetter</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90611#M6013</link>
      <description>&lt;P&gt;Again, I acknowledge that this is both weird and kind of silly.   I'm working on a simple module to provide this core switching use case, so there will be a better way soon.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2013 05:03:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90611#M6013</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-04-12T05:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: conditional eval ResultsValueSetter</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90612#M6014</link>
      <description>&lt;P&gt;Now I understand the meaning of your workaround, many thanks !&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2013 16:01:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/conditional-eval-ResultsValueSetter/m-p/90612#M6014</guid>
      <dc:creator>sbsbb</dc:creator>
      <dc:date>2013-04-15T16:01:21Z</dc:date>
    </item>
  </channel>
</rss>

