<?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: is it possible to execute code based on a condition? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578437#M10964</link>
    <description>&lt;P&gt;Yes I tried with fillnull but despite the zero values, the field names are wrong.&lt;BR /&gt;Maybe I solved it by editing the | command stats sum&lt;BR /&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 15 Dec 2021 09:36:30 GMT</pubDate>
    <dc:creator>antonio147</dc:creator>
    <dc:date>2021-12-15T09:36:30Z</dc:date>
    <item>
      <title>is it possible to execute code based on a condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578339#M10955</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;I wanted to ask a question: "is it possible to execute code based on a condition"?&lt;BR /&gt;example: if A = B then "rename C as D" else "add a column"&lt;/P&gt;&lt;P&gt;My problem:&lt;BR /&gt;the where returns columns usually 2, (DIRECT, INDIRECT) but there are some cases that returns 3 (DIRECT, INDIRECT, SPC)&lt;BR /&gt;a case that returns only 1 (INDIRECT)&lt;BR /&gt;another that returns 1 (DIRECT).&lt;BR /&gt;When I do the chart, the third field is called "row 3" (I hope to solve with rename).&lt;BR /&gt;When I have only one field (INDIRECT) it is called "row 1" but if I call it "DIRECT" it is not good as the values ​​are from the INDIRECT.&lt;BR /&gt;Same thing for the field only (LIVE).&lt;BR /&gt;The problem I would like is that the chart always has 2 bars for both DIRECT and INDIRECT, even when there is not one of the two.&lt;/P&gt;&lt;P&gt;with this code I have:&lt;BR /&gt;| stats sum (*) by OFFERTA&lt;BR /&gt;| transpose&lt;BR /&gt;| addtotals fieldname = "TOTAL"&lt;BR /&gt;| rename "row 1" as "DIRECT"&lt;BR /&gt;| rename "row 2" as "INDIRECT"&lt;BR /&gt;| rename "row 3" as "SPC"&lt;/P&gt;&lt;P&gt;Solar year&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DIRECT&amp;nbsp; &amp;nbsp; &amp;nbsp;INDIRECT&amp;nbsp; &amp;nbsp; &amp;nbsp;TOTAL&lt;BR /&gt;sum (00_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;BR /&gt;sum (01_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; 32&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;48&lt;BR /&gt;sum (02_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; 42&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52&lt;BR /&gt;sum (03_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; 30&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 38&lt;/P&gt;&lt;P&gt;but if I only have 1 field (INDIRECT)&lt;BR /&gt;I have as a result:&lt;/P&gt;&lt;P&gt;Solar Year&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DIRECT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TOTAL&lt;BR /&gt;sum (00_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;BR /&gt;sum (01_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;sum (02_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;sum (03_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;BR /&gt;sum (04_PREVIOUS_MONTH)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like the chart to have also in this case the two fields with DIRECT and INDIRECT with the DIRECT field all zero&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 15:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578339#M10955</guid>
      <dc:creator>antonio147</dc:creator>
      <dc:date>2021-12-14T15:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: is it possible to execute code based on a condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578432#M10963</link>
      <description>Hi&lt;BR /&gt;Have you try to use fillnull before stats for those null values? As you sum those then it shouldn't be a issue if those missing fields have value 0.&lt;BR /&gt;r. Ismo&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Fillnull" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Fillnull&lt;/A&gt;</description>
      <pubDate>Wed, 15 Dec 2021 08:59:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578432#M10963</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-12-15T08:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: is it possible to execute code based on a condition?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578437#M10964</link>
      <description>&lt;P&gt;Yes I tried with fillnull but despite the zero values, the field names are wrong.&lt;BR /&gt;Maybe I solved it by editing the | command stats sum&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 09:36:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/is-it-possible-to-execute-code-based-on-a-condition/m-p/578437#M10964</guid>
      <dc:creator>antonio147</dc:creator>
      <dc:date>2021-12-15T09:36:30Z</dc:date>
    </item>
  </channel>
</rss>

