<?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 Assigning arbitrary values to a variable dependent on subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Assigning-arbitrary-values-to-a-variable-dependent-on-subsearch/m-p/155960#M43880</link>
    <description>&lt;P&gt;I have a transaction defined where a trade goes through some stages in its lifecycle.  Unfortunately, the markers for these stages aren't consistent in their form, eg.&lt;/P&gt;

&lt;P&gt;"&amp;lt;$DealId&amp;gt; : The deal has hit stage BOOKED"&lt;BR /&gt;&lt;BR /&gt;
"&amp;lt;$DealId&amp;gt; : The deal is EXECUTED"&lt;BR /&gt;&lt;BR /&gt;
"&amp;lt;$DealId&amp;gt; : Received CONFIRMATION"&lt;BR /&gt;&lt;BR /&gt;
will be found at various times in the transaction.&lt;/P&gt;

&lt;P&gt;I have come up with a query, but it keeps throwing errors :  "&lt;EM&gt;Fields cannot be assigned a boolean result. Instead, try if([bool expr], [expr], [expr]).&lt;/EM&gt; "&lt;/P&gt;

&lt;P&gt;Here's the query&lt;BR /&gt;&lt;BR /&gt;
DealId="*" | transaction DealId |&lt;BR /&gt;&lt;BR /&gt;
eval confirmed=searchmatch("Received CONFIRMATION") |&lt;BR /&gt;&lt;BR /&gt;
eval executed=searchmatch("The deal is EXECUTED" AND "DownstreamSystemId" |&lt;BR /&gt;&lt;BR /&gt;
eval booked=searchmatch("Deal has hit stage EXECUTED") |&lt;BR /&gt;&lt;BR /&gt;
eval status=case(confirmed==true, "CONFIRMED", executed==true, "EXECUTED", booked==true, "BOOKED")&lt;BR /&gt;&lt;BR /&gt;
| table DealId, allocQty, price, value, transactTime, status&lt;/P&gt;

&lt;P&gt;A completed transaction will have all of these stages, I'm trying to keep track of which stage a particular deal is up to.&lt;/P&gt;

&lt;P&gt;It also feels horribly inefficient, is there a better way of writing this query?&lt;/P&gt;</description>
    <pubDate>Wed, 19 Feb 2014 03:09:50 GMT</pubDate>
    <dc:creator>wardallen</dc:creator>
    <dc:date>2014-02-19T03:09:50Z</dc:date>
    <item>
      <title>Assigning arbitrary values to a variable dependent on subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-arbitrary-values-to-a-variable-dependent-on-subsearch/m-p/155960#M43880</link>
      <description>&lt;P&gt;I have a transaction defined where a trade goes through some stages in its lifecycle.  Unfortunately, the markers for these stages aren't consistent in their form, eg.&lt;/P&gt;

&lt;P&gt;"&amp;lt;$DealId&amp;gt; : The deal has hit stage BOOKED"&lt;BR /&gt;&lt;BR /&gt;
"&amp;lt;$DealId&amp;gt; : The deal is EXECUTED"&lt;BR /&gt;&lt;BR /&gt;
"&amp;lt;$DealId&amp;gt; : Received CONFIRMATION"&lt;BR /&gt;&lt;BR /&gt;
will be found at various times in the transaction.&lt;/P&gt;

&lt;P&gt;I have come up with a query, but it keeps throwing errors :  "&lt;EM&gt;Fields cannot be assigned a boolean result. Instead, try if([bool expr], [expr], [expr]).&lt;/EM&gt; "&lt;/P&gt;

&lt;P&gt;Here's the query&lt;BR /&gt;&lt;BR /&gt;
DealId="*" | transaction DealId |&lt;BR /&gt;&lt;BR /&gt;
eval confirmed=searchmatch("Received CONFIRMATION") |&lt;BR /&gt;&lt;BR /&gt;
eval executed=searchmatch("The deal is EXECUTED" AND "DownstreamSystemId" |&lt;BR /&gt;&lt;BR /&gt;
eval booked=searchmatch("Deal has hit stage EXECUTED") |&lt;BR /&gt;&lt;BR /&gt;
eval status=case(confirmed==true, "CONFIRMED", executed==true, "EXECUTED", booked==true, "BOOKED")&lt;BR /&gt;&lt;BR /&gt;
| table DealId, allocQty, price, value, transactTime, status&lt;/P&gt;

&lt;P&gt;A completed transaction will have all of these stages, I'm trying to keep track of which stage a particular deal is up to.&lt;/P&gt;

&lt;P&gt;It also feels horribly inefficient, is there a better way of writing this query?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2014 03:09:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-arbitrary-values-to-a-variable-dependent-on-subsearch/m-p/155960#M43880</guid>
      <dc:creator>wardallen</dc:creator>
      <dc:date>2014-02-19T03:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning arbitrary values to a variable dependent on subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assigning-arbitrary-values-to-a-variable-dependent-on-subsearch/m-p/155961#M43881</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DealId="*" | transaction DealId |
eval status=case(searchmatch("Received CONFIRMATION"), "CONFIRMED", searchmatch("\"The deal is EXECUTED\" AND \"DownstreamSystemId\""), "EXECUTED", searchmatch("Deal has hit stage EXECUTED"), "BOOKED")| table DealId, allocQty, price, value, transactTime, status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Feb 2014 05:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assigning-arbitrary-values-to-a-variable-dependent-on-subsearch/m-p/155961#M43881</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-02-19T05:41:47Z</dc:date>
    </item>
  </channel>
</rss>

