Trouble getting Field Calculator Processor to calculate new field

424
2
03-09-2022 11:31 AM
AbigailStephens
New Contributor III

We are trying to use a Field Calculator Processor to create a new ID field that concatenates a simple 2 character text string with a string version of the ObjectID field. The idea is that this new ID field would look something like

XX125​

where 'XX' is the string and '125' is the ObjectID value.

To achieve this in ArcGIS Pro, we used the Calculate Field tool with this Python 3 expression:

'XX'+str(!objectid!)

The goal is to have the Field Calculator processor generate this value for new submissions to a dataset as they pass through GeoEvent, which is calculating some other fields as well.

Here are the Expressions we've tried in the Field Calculator processor. In GeoEvent the objectID field is interpreted as an integer.

'XX'+toString(objectid)
'XX'+objectid
concat('XX', toString(objectid))
concat('XX', objectid)​

We've also tried setting up Field Mapper processors on either side of the Field Calculator processor to change the ObjectID field from an integer to a string type, then tried both of the expressions here:

'XX'+objectid
concat('XX', objectid)

It is unclear to me why neither of these methods (or any of the expressions listed) are working, has anyone else had similar trouble or know what might be wrong?

(We're running ArcGIS Enterprise (including GeoEvent Server) 10.7.1 on Linux)

0 Kudos
2 Replies
KimGarbade
Occasional Contributor III

Odd. But maybe this is a clue:

KimGarbade_0-1646858425179.png

So maybe something like: 

concat('XX',valueOf(ObjectID)) 

or

concat('XX',Trim(valueOf(ObjectID)))

or

'XX' + valueOf(ObjectID)

Even though it says on the same page that "The toString( ) and valueOf( ) functions wrap identical implementations."

0 Kudos
AbigailStephens
New Contributor III

I did not notice that while scouring the page - thanks @KimGarbade ! I will update that and try the valueOf function instead today!

0 Kudos