Select to view content in your preferred language

Concatenate two fields in standalone table in ArcPro project

569
3
02-22-2025 05:20 AM
EngineeringLockport
Occasional Contributor

Is it possible to concatenate 2 columns in a standalone table within an arcpro project?  I believe this would be possible within the attribute rules of the table, but I am not familiar with attribute rules and how to set them up.

 

Any help would be greatly appreciated!

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

You mean by not adding a new text field and concatenating two existing fields into the new one, I am guessing.

This is the existing calculation topic

Attribute rule script expression examples—ArcGIS Pro | Documentation

or there may be something in their github site

Esri/arcade-expressions: ArcGIS Arcade expression templates for all supported profiles in the ArcGIS...


... sort of retired...
BarryNorthey
Frequent Contributor

This is the first time I tried this so I suggest you experiment with dummy data.

  • Make sure the table is in a geodatabase. Export as needed.
  • The standalone table should have a GlobalID field. Use the Add Global IDs GP tool.
  • Create a new (text) field in the table to receive the results. You can specify an existing field but it will overwrite values.  
  • There are a few ways to open the Attribute Rules view, but in this example, the target table was added to a Map > right click on the table > Data Design > Attribute Rules.
  • Under the Calculation tab > Add Rule pulldown > click Immediate Calculation. A panel opens on the right called New Rule.
    • Rename the Rule Name as Concatenate Fields for example.
    • Set the target Field
    • Build the expression. In my example, I am concatenating text field ident with model with a space between.

var ident = $feature.ident;

var model = $feature.model

return Concatenate([ident +" "+ model], ' ');

  • Set the Triggers to Insert and Update.
  • Triggering Fields is explained here. In our example we want attribute rules to apply only when updates are done to fields ident and model so we could set them active.

BarryNorthey_0-1740255249740.png

  • Make sure that Execution is not Disabled.
  • Click Save in the Manage Edits group.
  • Close the Attributes Rule view.
  • Insert a new row in your table and add values to fields ident and model. Field ident_model should update. You can Save or Discard the edits.

An Attribute Rule can be disabled here by checking it on in the Disabled column.

BarryNorthey_1-1740255322547.png

 

 

 

RhettZufelt
MVP Notable Contributor

are you needing an attribute rule, or just looking for a way to concatenate?

Easiest way is probably with the Field Calculator.  Open the attribute table in Pro, enable editing, right click on the field you want to update, select Calculate Field  (or use Claculate Field GP Tool), then set expression to:

 

!field1! + " " + !field2!

 

will concatenate the two field values into one field with a space separating them.  (remove the + " " to get rid of the space)
If you are wanting this 'automatically' when you add/edit the data, then an attribute rule is probably what you are after.

R_

0 Kudos