<?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: IF- ELSE script in the field calculator (number classification) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569306#M44625</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN title=""&gt;It worked&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 May 2020 22:18:08 GMT</pubDate>
    <dc:creator>RTMRTM</dc:creator>
    <dc:date>2020-05-21T22:18:08Z</dc:date>
    <item>
      <title>IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569296#M44615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;I have a field where they stored phone numbers, &lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;called "Sent Phone"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;in my country the phone numbers have 8 characters&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;I made a field called "Length" ,&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;to find out how many characters the field has "Sent Phone"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;then I made a field called&lt;/SPAN&gt;&lt;/SPAN&gt; "New Phone"&amp;nbsp; &lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;to classify only numbers that have 8 characters&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;I need to make a script that pastes the numbers that have 8 catechists in "New Phone" and if it doesn't have 8, put 0&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="305" style="width: 610px; border-collapse: collapse;" width="240"&gt;&lt;TBODY&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border: 0.5pt solid windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;STRONG style="color: #000000; font-size: medium; font-family: Calibri; "&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;STRONG style="color: #000000; font-size: medium; font-family: Calibri; "&gt;Sent Phone&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;STRONG style="color: #000000; font-size: medium; font-family: Calibri; "&gt;Length&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 145.57px; background-color: transparent;"&gt;&lt;STRONG style="color: #000000; font-size: medium; font-family: Calibri; "&gt;New Phone&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;22&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;213&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;3&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;4&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;5&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;33445678&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;8&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;33445678&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;6&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;11&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;7&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;2&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;8&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;12569826&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;8&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;12569826&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;9&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;12560912&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;8&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;12560912&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15pt;"&gt;&lt;TD height="20" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; width: 145.57px; height: 15pt; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;10&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;34235677&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 145.44px; background-color: transparent;"&gt;&lt;SPAN style="color: #000000; font-family: Calibri; font-size: medium;"&gt;8&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;34235677&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;sorry for my bad English&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 18:14:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569296#M44615</guid>
      <dc:creator>RTMRTM</dc:creator>
      <dc:date>2020-05-21T18:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569297#M44616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your illustration, have you updated the Length field already, or is that to be part of the script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My first thought is to use an update cursor with arcpy or do you want to keep this at the field calculator level?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 18:24:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569297#M44616</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-05-21T18:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569298#M44617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your illustration, have you updated the Length field already, or is that to be part of the script?&lt;/P&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;R//I currently have the length field updated&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first thought is to use an update cursor with arcpy or do you want to keep this at the field calculator level?&lt;/P&gt;&lt;P&gt;R// &lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;I would like to keep it from the field calculator&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 18:35:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569298#M44617</guid>
      <dc:creator>RTMRTM</dc:creator>
      <dc:date>2020-05-21T18:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569299#M44618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;code:&lt;/P&gt;&lt;P&gt;func(!Sent Phone!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pre-logic script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# only works for a string, add some&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#logic to test for str, int float etc&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#then if/else it in a similar block&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;func&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;input&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; len&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;input&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; input
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'0'&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; result‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:30:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569299#M44618</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-12-12T00:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569300#M44619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to David's answer, this can be accomplished with a one-liner in the expression block that doesn't require a pre-calculated length field:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;!Sent Phone! &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; len&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;!Sent Phone!&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'0'&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 19:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569300#M44619</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-05-21T19:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569301#M44620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;on looking back at my answer I'm also missing quotes to make 0 a string. Have edited or will try if able. Loving the one liner Joshua!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 19:56:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569301#M44620</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-21T19:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569302#M44621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;I have a problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN title=""&gt;the script works perfectly, add it as precess in modelbuilder&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN title=""&gt;it works for me when I have modelbuilder open, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image" height="300" src="https://community.esri.com/legacyfs/online/493056_msi.PNG" width="491" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;but when I run it from the sale of parameters it doesn't work&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;IMG alt="" class="jive-emoji image-2 jive-image" height="213" src="https://community.esri.com/legacyfs/online/493057_2.PNG" width="376" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;returns this error&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;&lt;IMG alt="" class="jive-emoji jive-image image-3 j-img-original" src="https://community.esri.com/legacyfs/online/493079_3.PNG" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 21:47:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569302#M44621</guid>
      <dc:creator>RTMRTM</dc:creator>
      <dc:date>2020-05-21T21:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569303#M44622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sharing the full error message would be helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 21:56:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569303#M44622</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-21T21:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569304#M44623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Executing (Calculate Field): CalculateField "C:\Users\Shp_salida\001.shp"&lt;BR /&gt;&amp;nbsp;Phone func( !Telefono_C! ) PYTHON_9.3 "def func(input):\n&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(input) == 8:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = input\n&amp;nbsp;&amp;nbsp;&amp;nbsp; else:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = 0\n&amp;nbsp;&amp;nbsp;&amp;nbsp; return result\n"&lt;BR /&gt;Start Time: Thu May 21 15:59:34 2020&lt;BR /&gt;ERROR 000539: Error running expression: func( 5 ) &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 2, in func&lt;BR /&gt;TypeError: object of type 'int' has no len()&lt;/P&gt;&lt;P&gt;Failed to execute (Calculate Field).&lt;BR /&gt;Failed at Thu May 21 15:59:34 2020 (Elapsed Time: 0.01 seconds)&lt;BR /&gt;Failed to execute (Model72).&lt;BR /&gt;Failed at Thu May 21 15:59:34 2020 (Elapsed Time: 1.34 seconds)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 22:02:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569304#M44623</guid>
      <dc:creator>RTMRTM</dc:creator>
      <dc:date>2020-05-21T22:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569305#M44624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok so an integer is being passed into the function. Replace if len(input) with if len(str(input))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 22:12:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569305#M44624</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-21T22:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: IF- ELSE script in the field calculator (number classification)</title>
      <link>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569306#M44625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN title=""&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN title=""&gt;It worked&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2020 22:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/if-else-script-in-the-field-calculator-number/m-p/569306#M44625</guid>
      <dc:creator>RTMRTM</dc:creator>
      <dc:date>2020-05-21T22:18:08Z</dc:date>
    </item>
  </channel>
</rss>

