Select to view content in your preferred language

Add domains to TargetField (existing in target GDB) based on SourceSchema fields

393
6
Jump to solution
03-18-2024 04:34 AM
SumitMishra_aam
New Contributor III

Hi,

I am new to Data Loading Tools. Can I add domains to TargetField (existing in target GDB) based on SourceSchema fields if the source does not have domains? @TedHoward2 

0 Kudos
1 Solution

Accepted Solutions
TedHoward2
Esri Contributor

Yes that’s exactly how it works. I would suggest adding custom expressions to user.py instead of base.py. This will maintain your expressions if you ever run the Update Data Loading Workspace Schema tool. 

View solution in original post

0 Kudos
6 Replies
MikeMillerGIS
Esri Frequent Contributor

Not in data loading tools.  They only are for the transfer of data, not schema.

0 Kudos
SumitMishra_aam
New Contributor III

I want data transfer only but assign domain to a field based on source field values

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

There is a new capability coming in 3.3 that will create an coded value domain from the values in the column.  You could leverage that after transferring the data.  At 3.2 and before, you will need to script the process.

TedHoward2
Esri Contributor

The term "assign domain" is throwing us off I think. Do you mean load values to a target field that already has a domain? There are a couple ways to do that. As Mike mentions you could script it by writing a python expression to transfer values. You could also create your own Lookup sheet and map source field(s) values to a target value. The Source field does not have to have a domain.

SumitMishra_aam
New Contributor III

Thanks for the reply @TedHoward2 ,

"Assign Domain" means "Domains" already exist in the target geodatabase and I have to assign on the basis of source field values. Can I use the base.py to assign domain codes to the target like the following:

def assign_domain(new_level: int, new_color: int, new_line_wt: int, new_linetype: str) -> int:

         if new_level == 2 and new_color == 3 and new_line_wt == 2 and new_linetype == "Solid":

                    return 1

         else: return 2

and call the function assign_domain(!NewLevel!, !NewColor!, !NewLineWt!, !NewLinetype!) in Expression column of TargetField

0 Kudos
TedHoward2
Esri Contributor

Yes that’s exactly how it works. I would suggest adding custom expressions to user.py instead of base.py. This will maintain your expressions if you ever run the Update Data Loading Workspace Schema tool. 

0 Kudos