Hi~~~
def Reclass(arg): if arg in ["222", "333"]: return "<Null>" else: return arg
I want the results as shown below.
Do not return "<NULL>" because it will not set a field to SQL NULL, it will set a field to a text string that says "<NULL>". If you want to set a field to SQL NULL, you want to return None.
Thank you
Thank you so much~~~~~~
Nearly there, but you need to pass in 2 arguments.
<SPAN class="comment token">#prelogic codeblock</SPAN> <SPAN class="keyword token">def</SPAN> <SPAN class="token function">Reclass</SPAN><SPAN class="punctuation token">(</SPAN>arg1<SPAN class="punctuation token">,</SPAN> arg2<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> arg1 <SPAN class="keyword token">in</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"222"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"333"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="string token">"<Null>"</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">return</SPAN> arg2 <SPAN class="comment token">#code</SPAN> Reclass<SPAN class="punctuation token">(</SPAN>!NAME!<SPAN class="punctuation token">,</SPAN> !PNAME!<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.