As of 2024, ArcPro don't have this capablity yet, see here,   FME can do this job, FME specialized to do this job.

Enhance Append Tool to Allow Python/Arcade Expressions for Unmapped Fields

https://community.esri.com/t5/arcgis-pro-ideas/allow-arcade-expressions-in-parameters-of/idi-p/1192529

https://community.esri.com/t5/arcgis-pro-ideas/enhance-append-tool-to-allow-python-arcade/idi-p/1195885#comments

So far ArcPro v3.2.x does not allow you use Arcade expression to transform from YES to 1, NO to 0. 

So you can not do it within append tool fieldmapping file. 

If in future, you can do it, when you export fieldmapping file, this auto transformation will be saved into fieldmapping file. 

Then you don't use work around here. 

 

 

 

 

 

 

The problem

Unit response in city 

Unit response in Management Zone 

field in target layer schema is a domain type.

 Domain type means this field is int type. Not string type. It only store number as domain code. In my case, 1 for YES, 0 for NO

However, in source table, response in city column is Text field, it store YES and NO.

 

 

 

 

When I use append tool to transfer this field, you will get error, because Text type and int type does not match,  you can't put YES in int type field.The error is field unit response in city, in source, it is string, yes or no, however, in target table, it is interger type, 1 or 0. Warning, it actually using BooleanDomain, yes, for 1, no for 0.This is tricky part. 

 Target table use domain, 1 for yes, 0 for no,  domain field is short integer.  However in source table, it is string text field, with just YES, NO.  My idea is in source table to create extra column, translate from YES to 1, NO to 0. Use calculate field

 

work around

 Use extra field to calculate domain code column. 

Then map to this new added domain code column.  

  

 

 

 

 

Step 1

Create new column as domain code column ( int, short, long ) type.

 

 

 

 

 

 

 

Step 2 ( don't use )

Calculate domain code field use inline  python ( not recommend, because you have to do multiple times for each domain code value, in my case, I have to do 2 times, for 1 and 0)

 

 

 

 

 

 

Step 3 ( recommend use )

Calculate domain code field use python code block ( recommend, because you can do all of multiple domain code in 1 time)

use Arcade, recommend because you can do YES, NO at 1 time, 

Copy and paste following code into code block

if ($feature.Unit_Response_in_City_ == "YES"){

  return 1

} else if ($feature.Unit_Response_in_City_ == "NO"){

  return 0;

}

 

This error is because you turn on use select while nothing selected. Solution is turn off use select

 

 

use Arcade, recommend because you can do YES, NO at 1 time, 

Copy and paste following code into code block

 

 

 

if ($feature.Unit_Response_in_Management_Zon == "YES"){

 

  return 1

 

} else if ($feature.Unit_Response_in_Management_Zon == "NO"){

 

  return 0;

 

}

 

 

 

 

 

 

 

Step 4

 re-run append tool,  re-map those 2 domain fields to new created column which translate YES, NO into 1,0.

 

 

 

by

Please log in or register