Very new to ArcPro and have hit a wall. I can't seem to find a solution anywhere so here goes...
Using Field Calculator to populate a new Text (50) field.
In ArcMap I would have entered [Field1] & "-" & [Field2].
In ArcPro I've entered !Field1! + '-' + !Field2!.
The '-' turns red and the process fails. I've also tried "-".
Expression type set to Python3.
Advice on this seemingly simple task?
Thanks!
Solved! Go to Solution.
Chris,
Thanks for your response. It wasn't giving me much detail. I actually just figured out what the issue was a few minutes ago.
I was entering it as follows: [Field1] & "-" & [Field2]
I entered it as: [Field1]&"-"&[Field2] <Removing the spaces resolved the issue.
Did you click on "View details" to get more information on the error? (You can get to the tool's results, including any error messages, either by clicking on "View details" in the error window that pops up, or by going to the Catalog tab, clicking on "History", and mousing-over the tool name in the list.) It could be that the new field isn't wide enough to hold the concatenated values. I think a quoted string will always turn red in the field calculator.
Chris,
Thanks for your response. It wasn't giving me much detail. I actually just figured out what the issue was a few minutes ago.
I was entering it as follows: [Field1] & "-" & [Field2]
I entered it as: [Field1]&"-"&[Field2] <Removing the spaces resolved the issue.
'{}-{}'.format(!Field1!, !Field2!)
the format approach in python handles type conversion automatically to string/text regardless of the input