In ArcGIS FieldMapping, is there any way to add "FieldName", while we use MergeRule-Join?

Please refer the attachment;

I know, we can concatenate Field Values using MergeRule-Join, with Delimiter "|". but is it possible to add FieldName before FieldValue.

enter image description here


There is no configuration of the FieldMapping in tools like Spatial Join that will add the field name to the value. However, what you have shown is just concatenating several fields together for each individual feature, so you can create a text field in the original dataset that is long enough to hold the values and create a Field calculation that will combine fields with field names the way you have shown.

Parser: VB Script

Use Code Block: Checked

Pre-Logic Script Code:

Output = ""
If [FirstName] > " " Then Output = "FirstName: " & [FirstName]
If [MiddleName] > " " Then
  if Output > "" Then
    Output = Output & " | MiddleName: " & [MiddleName]
    Output = "MiddleName: " & [MiddleName]
  End If
End If
If [LastName] > " " Then
  if Output > "" Then
    Output = Output & " | LastName: " & [LastName]
    Output = "LastName: " & [LastName]
  End If
End If

Expression: Output

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.