<?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 Python in Field Calculator - mod function in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652160#M50793</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are two fields in a topo line feature class, Elev for elevation and LineType10. I want to set LineType10 to 1 if Elev % 10 == 0, and 2 otherwise. The purpose is to be able to symbolize at ten foot intervals. I've got the code below, which doesn't give errors but also doesn't set any values. I've also used the plain % mod symbol. Any ideas why this doesn't run? Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pre-Logic&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def SetTen(elv, line): &amp;nbsp; if math.fmod(elv) == 0: &amp;nbsp;&amp;nbsp;&amp;nbsp; line = 1 &amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp; line = 2 &amp;nbsp; return line&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Window&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;SetTen( !Elev!, !LineType10!)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2014 17:42:13 GMT</pubDate>
    <dc:creator>Zeke</dc:creator>
    <dc:date>2014-01-16T17:42:13Z</dc:date>
    <item>
      <title>Python in Field Calculator - mod function</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652160#M50793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are two fields in a topo line feature class, Elev for elevation and LineType10. I want to set LineType10 to 1 if Elev % 10 == 0, and 2 otherwise. The purpose is to be able to symbolize at ten foot intervals. I've got the code below, which doesn't give errors but also doesn't set any values. I've also used the plain % mod symbol. Any ideas why this doesn't run? Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pre-Logic&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def SetTen(elv, line): &amp;nbsp; if math.fmod(elv) == 0: &amp;nbsp;&amp;nbsp;&amp;nbsp; line = 1 &amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp; line = 2 &amp;nbsp; return line&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Window&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;SetTen( !Elev!, !LineType10!)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 17:42:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652160#M50793</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-01-16T17:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Field Calculator - mod function</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652161#M50794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Greg,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure exactly why your code isn't working, but it might be good to simplify your code a little. First, you are calculating the value of LineType10, so you don't need to pass it as a variable to the function. You can also just return the value for line instead of setting and then returning a variable called line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does this work for you?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Pre-Logic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def isTen(elev): &amp;nbsp; if elev%10==0: &amp;nbsp;&amp;nbsp;&amp;nbsp; return 1 &amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp; return 2&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;isTen( !Elev! )&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, just to confirm, LineType10 is a int field right?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 18:03:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652161#M50794</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-01-16T18:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Field Calculator - mod function</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652162#M50795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, that worked great. Yes, LineTyp10 is an int. Much appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 18:54:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/652162#M50795</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-01-16T18:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python in Field Calculator - mod function</title>
      <link>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/1051117#M60890</link>
      <description>&lt;P&gt;The best website for&amp;nbsp;&lt;A title="Download Mod Apk" href="https://www.appa1.com/" target="_blank" rel="noopener"&gt;Download Mod Apk&lt;/A&gt;&amp;nbsp;for free&lt;/P&gt;</description>
      <pubDate>Sun, 25 Apr 2021 07:13:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-in-field-calculator-mod-function/m-p/1051117#M60890</guid>
      <dc:creator>SurajBharati</dc:creator>
      <dc:date>2021-04-25T07:13:58Z</dc:date>
    </item>
  </channel>
</rss>

