Select to view content in your preferred language

VB to Python Conversion Question

594
2
Jump to solution
07-12-2023 10:47 AM
JD1016
by
Frequent Contributor

Hello,

I preface by saying I know next to nothing about Python scripting.  There...got that out of the way.

We would like to populate a "text" field called GISIDNUMBER with the following---CAP76.  The number will vary and comes from the OBJECTID field.

In VB the script it would be written as "CAP" + [OBJIDTXT].  Whereby we added a new field converting the OBJECTID to text and called it OBJIDFIELD.

Could someone supply a Python script that would do the process all in one without creating a new field?

Thank you.

Jeff

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

One of these

"CAP" + str(!OBJECTID!)

"CAP{}".format(!OBJECTID!)

f"CAP{!OBJECTID!}"  # only ArcGIS Pro

Have a great day!
Johannes

View solution in original post

0 Kudos
2 Replies
JohannesLindner
MVP Frequent Contributor

One of these

"CAP" + str(!OBJECTID!)

"CAP{}".format(!OBJECTID!)

f"CAP{!OBJECTID!}"  # only ArcGIS Pro

Have a great day!
Johannes
0 Kudos
JD1016
by
Frequent Contributor

Thank you, Johannes!!!

This worked perfectly.

You have a great day as well.

Jeff

0 Kudos