<?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: FeatuerLayer .caculate that concatenates a field with a standalone string in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1356314#M9361</link>
    <description>&lt;P&gt;Hey, your calc_expression value should be:&lt;/P&gt;&lt;PRE&gt;{"field": "assetid", "sqlExpression": "CONCAT('NNTREE-', OBJECTID)"}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 15:13:50 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2023-12-04T15:13:50Z</dc:date>
    <item>
      <title>FeatuerLayer .caculate that concatenates a field with a standalone string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1356000#M9358</link>
      <description>&lt;P&gt;Good afternoon!&lt;/P&gt;&lt;P&gt;I am trying to write a short script that will periodically be run to check whether there are new rows in hosted layer. When there are new rows, I want a particular field to calculated by combing a string prefix ("NNTREE-") with the OBJECTID value. I found some past discussions on .calulate, several which managed to resolve people's problems, but none dealt specifically with trying to combine a field with a string in this way.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis.gis import GIS
gis = GIS("pro")
trees = gis.content.get('ebc917bcf648444a8161f4dca4afb7ec')

trees.layers[0].calculate(
    where="assetid IS NULL",
    calc_expression = {
        'field': 'assetid',
        "sqlExpression" :'CONCAT("NNTREE-", OBJECTID)'})

Exception: 
'Invalid field: NNTREE-' parameter is invalid
(Error Code: 400)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for any help.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 21:36:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1356000#M9358</guid>
      <dc:creator>CameronAndrew</dc:creator>
      <dc:date>2023-12-01T21:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: FeatuerLayer .caculate that concatenates a field with a standalone string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1356314#M9361</link>
      <description>&lt;P&gt;Hey, your calc_expression value should be:&lt;/P&gt;&lt;PRE&gt;{"field": "assetid", "sqlExpression": "CONCAT('NNTREE-', OBJECTID)"}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 15:13:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1356314#M9361</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-12-04T15:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: FeatuerLayer .caculate that concatenates a field with a standalone string</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1357925#M9385</link>
      <description>&lt;P&gt;That' great, thank you. I had managed a slightly more convoluted workaround to achieve the same effect, but this is preferable.&amp;nbsp; I appreciate your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like it was just the single/double quotation marks at issue? As someone primarily accustomed to R, I need to get used to there being an important distinction between those two characters in SQL syntax.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 13:54:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featuerlayer-caculate-that-concatenates-a-field/m-p/1357925#M9385</guid>
      <dc:creator>CameronAndrew</dc:creator>
      <dc:date>2023-12-07T13:54:41Z</dc:date>
    </item>
  </channel>
</rss>

