Good afternoon!
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.
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)
Thank you for any help.