<?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 How could I check for optional keywords and options in custom command? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362175#M5262</link>
    <description>&lt;P&gt;In building a custom command I am trying to validated the presence/absence of an option:&lt;/P&gt;

&lt;P&gt;Sample code doing the assignment can be found below&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()&lt;BR /&gt;
field = options.get('field', None)&lt;/P&gt;

&lt;H2&gt;charsense = options.get('detect', None)&lt;/H2&gt;

&lt;P&gt;Very simply I want to assign none to charsense if the option is not present.&lt;BR /&gt;
Conversely, I would like to NOT perform character detection if the value is not present.&lt;/P&gt;

&lt;P&gt;Additionally, any way to present a usage to the user in the event they do not give either option would be beneficial.&lt;/P&gt;

&lt;P&gt;Thank you very much, you guys and gals are always a huge help&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2017 00:16:57 GMT</pubDate>
    <dc:creator>grimlock</dc:creator>
    <dc:date>2017-05-04T00:16:57Z</dc:date>
    <item>
      <title>How could I check for optional keywords and options in custom command?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362175#M5262</link>
      <description>&lt;P&gt;In building a custom command I am trying to validated the presence/absence of an option:&lt;/P&gt;

&lt;P&gt;Sample code doing the assignment can be found below&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults()&lt;BR /&gt;
field = options.get('field', None)&lt;/P&gt;

&lt;H2&gt;charsense = options.get('detect', None)&lt;/H2&gt;

&lt;P&gt;Very simply I want to assign none to charsense if the option is not present.&lt;BR /&gt;
Conversely, I would like to NOT perform character detection if the value is not present.&lt;/P&gt;

&lt;P&gt;Additionally, any way to present a usage to the user in the event they do not give either option would be beneficial.&lt;/P&gt;

&lt;P&gt;Thank you very much, you guys and gals are always a huge help&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 00:16:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362175#M5262</guid>
      <dc:creator>grimlock</dc:creator>
      <dc:date>2017-05-04T00:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: How could I check for optional keywords and options in custom command?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362176#M5263</link>
      <description>&lt;P&gt;Below is the code I ended up using: &lt;/P&gt;

&lt;P&gt;For optional keywords:&lt;BR /&gt;
&lt;CODE&gt;detect = None&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;if 'detection' in keywords:&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;detect = True&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;For required keywords missing options:&lt;BR /&gt;
&lt;CODE&gt;if not options.has_key('field'):&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;output_result = splunk.Intersplunk.generateErrorResults("Error Message placed here")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 12:51:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362176#M5263</guid>
      <dc:creator>grimlock</dc:creator>
      <dc:date>2017-05-16T12:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: How could I check for optional keywords and options in custom command?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362177#M5264</link>
      <description>&lt;P&gt;@grimlock - Thanks for posting your solution!  Please accept your answer so the question will show as closed.&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2017 14:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/How-could-I-check-for-optional-keywords-and-options-in-custom/m-p/362177#M5264</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-05-16T14:33:29Z</dc:date>
    </item>
  </channel>
</rss>

