<?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: CalculateField_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077809#M61716</link>
    <description>&lt;P&gt;Thanks for your help! thank of you i found the error!&lt;/P&gt;&lt;P&gt;i've forget an _ on the way to the gdb.&lt;/P&gt;&lt;P&gt;so now i've got that&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users/d.rouffart/AppData/Roaming/JetBrains/PyCharmCE2021.1/scratches/scratch.py&lt;BR /&gt;environnement charge&lt;BR /&gt;CalculateField ok&lt;/P&gt;&lt;P&gt;Process finished with exit code 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;one more time thanks for your help&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jul 2021 14:24:21 GMT</pubDate>
    <dc:creator>danielROUFFART1</dc:creator>
    <dc:date>2021-07-12T14:24:21Z</dc:date>
    <item>
      <title>CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077718#M61703</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;i need some help about the arcpy expression CalculateField_management.&lt;/P&gt;&lt;P&gt;So wrote a py program to correct some field in a layer.&lt;/P&gt;&lt;P&gt;so wrote my py prog like this&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Recherche de la gdb pour correction&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;ma_table = &lt;SPAN&gt;R"C:\représentation parcelaire\cadpmm_vierge.gdb"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# rappatriment des champs utilises dans la fonction&lt;BR /&gt;&lt;/SPAN&gt;expression = &lt;SPAN&gt;"ma_fonction(param_ccogrm=!ccogrm!, param_ddenom=!ddenom!)"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"environnement charge"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;# correction du champ ccogrm&lt;BR /&gt;&lt;/SPAN&gt;code_block: &lt;SPAN&gt;str &lt;/SPAN&gt;= &lt;SPAN&gt;"""def ma_fonction(param_ccogrm, param_ddenom):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   if param_ccogrm == 1 and ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU":&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      return 7&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      return None"""&lt;BR /&gt;&lt;/SPAN&gt;arcpy.CalculateField_management(&lt;BR /&gt;    &lt;SPAN&gt;in_table&lt;/SPAN&gt;=ma_table&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;field&lt;/SPAN&gt;=&lt;SPAN&gt;"ccogrm"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression&lt;/SPAN&gt;=expression&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression_type&lt;/SPAN&gt;=&lt;SPAN&gt;"PYTHON3"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;code_block&lt;/SPAN&gt;=code_block&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so when i execute the program, i've got an error message&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py", line 60, in &amp;lt;module&amp;gt;&lt;BR /&gt;code_block=code_block&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you help me to resolve my problem please. I don't see xhere is the problem .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 09:03:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077718#M61703</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-12T09:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077724#M61704</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;code_block ="""
def ma_fonction(param_ccogrm, param_ddenom):
    if (param_ccogrm == 1) and (ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU"):
       return 7
    return None
"""&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;don't put str = in the code block if you did&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 09:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077724#M61704</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-12T09:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077727#M61706</link>
      <description>&lt;P&gt;thanks for your help,&lt;/P&gt;&lt;P&gt;so i've retired the str in the prog and i've got the same message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 09:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077727#M61706</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-12T09:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077730#M61707</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/496369"&gt;@danielROUFFART1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You havent specified your table in the line - it is just the path to the geodatabase:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ma_table = r"C:\représentation parcelaire\cadpmm_vierge.gdb"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does it work if you specify the table name?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ma_table = r"C:\représentation parcelaire\cadpmm_vierge.gdb\ma_table"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formatting of the function also looks a bit strange where you have pasted it to the browser. Might it be safer to use the following?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;code_block = """
def ma_fonction(param_ccogrm, param_ddenom):
   if param_ccogrm == 1 and ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU":
      return 7
   else:
      return None
"""&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 09:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077730#M61707</guid>
      <dc:creator>HamishMorton</dc:creator>
      <dc:date>2021-07-12T09:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077731#M61708</link>
      <description>&lt;P&gt;so it looks like this now?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
# Recherche de la gdb pour correction
ma_table = R"C:\représentation parcelaire\cadpmm_vierge.gdb"
# rappatriment des champs utilises dans la fonction
expression = "ma_fonction(!ccogrm!, !ddenom!)"
print("environnement charge")
# correction du champ ccogrm
code_block = """
def ma_fonction(param_ccogrm, param_ddenom):
    if (param_ccogrm == 1) and (ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU"):
        return 7
    return None
"""
arcpy.CalculateField_management(
    in_table=ma_table,
    field="ccogrm",
    expression=expression,
    expression_type="PYTHON3",
    code_block=code_block
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 09:39:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077731#M61708</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-07-12T09:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077752#M61710</link>
      <description>&lt;P&gt;hi &lt;SPAN class="UserName lia-user-name lia-user-rank-Esri-Contributor lia-component-message-view-widget-author-username"&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/238758" target="_self"&gt;&lt;SPAN class=""&gt;HamishMorton&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;so i try your solution and i've got thie reponse for&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;# coding: utf-8&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Recherche de la gdb pour correction&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;ma_table = &lt;SPAN&gt;r"C:\représentation parcelaire\cadpmm_vierge.gdb\proprio"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# rappatriment des champs utilises dans la fonction&lt;BR /&gt;&lt;/SPAN&gt;expression = &lt;SPAN&gt;"ma_fonction(param_ccogrm=!ccogrm!, param_ddenom=!ddenom!)"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"environnement charge"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;# correction du champ ccogrm&lt;BR /&gt;&lt;/SPAN&gt;code_block =&lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;def ma_fonction(param_ccogrm, param_ddenom):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   if param_ccogrm == 1 and ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU":&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      return 7&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   else:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      return None&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;arcpy.CalculateField_management(&lt;BR /&gt;    &lt;SPAN&gt;in_table&lt;/SPAN&gt;=ma_table&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;field&lt;/SPAN&gt;=&lt;SPAN&gt;"ccogrm"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression&lt;/SPAN&gt;=expression&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression_type&lt;/SPAN&gt;=&lt;SPAN&gt;"PYTHON3"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;code_block&lt;/SPAN&gt;=code_block&lt;BR /&gt;)&lt;BR /&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"CalculateField ok"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for response:&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py&lt;BR /&gt;environnement charge&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py", line 27, in &amp;lt;module&amp;gt;&lt;BR /&gt;code_block=code_block&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5209, in CalculateField&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5206, in CalculateField&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.CalculateField_management(*gp_fixargs((in_table, field, expression, expression_type, code_block, field_type), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 160706: Cannot acquire a lock.&lt;BR /&gt;Échec de l’exécution de (CalculateField).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 11:40:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077752#M61710</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-12T11:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077753#M61711</link>
      <description>&lt;P&gt;thanks for your reply Dan,&lt;/P&gt;&lt;P&gt;but when i try this code it's doesn't work to. i've got a problem whith my code_block..&lt;/P&gt;&lt;P&gt;environnement charge&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py", line 21, in &amp;lt;module&amp;gt;&lt;BR /&gt;code_block=code_block&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5209, in CalculateField&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5206, in CalculateField&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.CalculateField_management(*gp_fixargs((in_table, field, expression, expression_type, code_block, field_type), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: ERROR 160706: Cannot acquire a lock.&lt;BR /&gt;Échec de l’exécution de (CalculateField).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i try to understand where is the problem but when i saw the esri explain i don't see&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 11:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077753#M61711</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-12T11:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077757#M61713</link>
      <description>&lt;P&gt;Okay thats a bit better. Is the feature class open or being edited in any other app? If so try closing those and then run the script again from wherever you are running it. e.g. your IDE.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 12:20:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077757#M61713</guid>
      <dc:creator>HamishMorton</dc:creator>
      <dc:date>2021-07-12T12:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077766#M61714</link>
      <description>&lt;P&gt;so i close arcgis pro and i try to start my py with charmPy and i've got that&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py&lt;BR /&gt;environnement charge&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:/Users/d.rouffart/PycharmProjects/pythonProject/2021_07_08_ReplaceValue.py", line 21, in &amp;lt;module&amp;gt;&lt;BR /&gt;code_block=code_block&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5209, in CalculateField&lt;BR /&gt;raise e&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5206, in CalculateField&lt;BR /&gt;retval = convertArcObjectToPythonObject(gp.CalculateField_management(*gp_fixargs((in_table, field, expression, expression_type, code_block, field_type), True)))&lt;BR /&gt;File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in &amp;lt;lambda&amp;gt;&lt;BR /&gt;return lambda *args: val(*gp_fixargs(args, True))&lt;BR /&gt;arcgisscripting.ExecuteError: Échec de l’exécution. Les paramètres ne sont pas valides.&lt;BR /&gt;ERROR 000732: Table en entrée: Dataset C:\représentation parcelaire\cadpmm_vierge.gdb\proprio does not exist or is not supported&lt;BR /&gt;Échec de l’exécution de (CalculateField).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Process finished with exit code 1&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 13:03:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077766#M61714</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-12T13:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077795#M61715</link>
      <description>&lt;P&gt;That is odd. I would make sure that your data still exists and that it is a feature class or table.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

path = r"C:\représentation parcelaire\cadpmm_vierge.gdb\proprio"

if arcpy.Exists(path):
  print("{} exists".format(path))
  desc = arcpy.Describe(path)
  print("Data type is {}".format(desc.dataType))
else:
  print("{} does not exist".format(path))&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 14:06:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077795#M61715</guid>
      <dc:creator>HamishMorton</dc:creator>
      <dc:date>2021-07-12T14:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077809#M61716</link>
      <description>&lt;P&gt;Thanks for your help! thank of you i found the error!&lt;/P&gt;&lt;P&gt;i've forget an _ on the way to the gdb.&lt;/P&gt;&lt;P&gt;so now i've got that&lt;/P&gt;&lt;P&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Users/d.rouffart/AppData/Roaming/JetBrains/PyCharmCE2021.1/scratches/scratch.py&lt;BR /&gt;environnement charge&lt;BR /&gt;CalculateField ok&lt;/P&gt;&lt;P&gt;Process finished with exit code 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;one more time thanks for your help&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 14:24:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1077809#M61716</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-12T14:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078144#M61719</link>
      <description>&lt;P&gt;so it's like this:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;# coding: utf-8&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;BR /&gt;arcpy.env.overwriteOutput = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Recherche de la gdb pour correction&lt;BR /&gt;&lt;/SPAN&gt;ma_table = &lt;SPAN&gt;r"C:\rvierge.gdb\proprio"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# rappatriment des champs utilises dans la fonction&lt;BR /&gt;&lt;/SPAN&gt;expression = &lt;SPAN&gt;"ma_fonction(!ccogrm!, !ddenom!)"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"environnement charge"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;# correction du champ ccogrm&lt;BR /&gt;&lt;/SPAN&gt;code_block = &lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;def ma_fonction(param_ccogrm, param_ddenom):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   if (param_ccogrm == 1) and (ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU"):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      return 7&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;    return None&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;arcpy.CalculateField_management(&lt;BR /&gt;    &lt;SPAN&gt;in_table&lt;/SPAN&gt;=ma_table&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;field&lt;/SPAN&gt;=&lt;SPAN&gt;"ccogrm"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression&lt;/SPAN&gt;=expression&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression_type&lt;/SPAN&gt;=&lt;SPAN&gt;"PYTHON3"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;code_block&lt;/SPAN&gt;=code_block&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;field_type&lt;/SPAN&gt;=&lt;SPAN&gt;'TEXT'&lt;BR /&gt;&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"CalculateField ok"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 06:16:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078144#M61719</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-13T06:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078178#M61720</link>
      <description>&lt;P&gt;hi ! i come back to you because now when i execute the script that's erase all of my field...&lt;/P&gt;&lt;P&gt;i just wanna change the nuber of certain lines of my field not erase...&lt;/P&gt;&lt;P&gt;do you now why the script does that?&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt; coding: utf-8&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;BR /&gt;arcpy.env.overwriteOutput = &lt;SPAN&gt;True&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# Recherche de la gdb pour correction&lt;BR /&gt;&lt;/SPAN&gt;ma_table = &lt;SPAN&gt;r"C:\representation_parcelaire\cadpmm_vierge.gdb\proprio"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# rappatriment des champs utilises dans la fonction&lt;BR /&gt;&lt;/SPAN&gt;expression = &lt;SPAN&gt;"ma_fonction(param_ccogrm=!ccogrm!, param_ddenom=!ddenom!)"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"environnement charge"&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;# correction du champ ccogrm&lt;BR /&gt;&lt;/SPAN&gt;code_block = &lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;def ma_fonction(param_ccogrm, param_ddenom):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   if (param_ccogrm == 1) and (param_ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU"):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;      return (param_ccogrm == 7)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;# return None&lt;BR /&gt;&lt;/SPAN&gt;arcpy.CalculateField_management(&lt;BR /&gt;    &lt;SPAN&gt;in_table&lt;/SPAN&gt;=ma_table&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;field&lt;/SPAN&gt;=&lt;SPAN&gt;"ccogrm"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression&lt;/SPAN&gt;=expression&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;expression_type&lt;/SPAN&gt;=&lt;SPAN&gt;"PYTHON3"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;code_block&lt;/SPAN&gt;=code_block&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;field_type&lt;/SPAN&gt;=&lt;SPAN&gt;"TEXT"&lt;BR /&gt;&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"CalculateField ok"&lt;/SPAN&gt;)&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jul 2021 09:34:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078178#M61720</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-13T09:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078199#M61721</link>
      <description>&lt;PRE&gt;&lt;SPAN&gt;return (param_ccogrm == 7)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;should just be:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;return 7&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;unless your field is of text type. In which case it should be:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;return str(7)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Also worth checking to make sure your conditions are correct.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 11:33:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078199#M61721</guid>
      <dc:creator>HamishMorton</dc:creator>
      <dc:date>2021-07-13T11:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078213#M61722</link>
      <description>&lt;P&gt;thank for your help &lt;SPAN class="Y2IQFc"&gt;effectively&lt;/SPAN&gt; it's all in Text type so i need to put str in my codeblock?&lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;PRE&gt;code_block = &lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;def getClass(param_ccogrm, param_ddenom):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   if str(param_ccogrm == 1) and str(param_ddenom == "COPROPRIETAIRES DU LOTISSEMENT LE COTEAU"):&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;       return str(7)&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;   else:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;       return None&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jul 2021 12:40:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078213#M61722</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-13T12:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: CalculateField_management</title>
      <link>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078216#M61723</link>
      <description>&lt;P&gt;ok it'work ! but now it's change all of my ccogrm part&amp;nbsp; with the number 7&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 12:45:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculatefield-management/m-p/1078216#M61723</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2021-07-13T12:45:31Z</dc:date>
    </item>
  </channel>
</rss>

