SetFieldPropsFromCSV

Title  Set Field Properties from CSV

Description

Set a field's alias and other field properties for layers and tables.

Usage

          
The output of Map Layers to CSV tool can be used as input here.
        The required schema of the csv LayerName, FieldName, FieldAlias, Visible, ReadOnly, SearchMode.
        The possible values for the SearchMode are:
        
  • Exact
  • Contains
  • StartsWith

License

Basic

Toolset

Map

Syntax

SetFieldPropsFromCSV (map_name, csv_file, {field_alias}, {field_visible}, {field_read_only}, {field_search_mode}, {input_project}, {field_order})

Parameter Explanation Data Type
map_name Dialog Reference

The map with layers and tables to set field properties on.

GPString
csv_file Dialog Reference

CSV with field properties information. The output of "Map Layers to CSV" tool can be used as input. The required schema of the csv LayerName, FieldName, FieldAlias, Visible, ReadOnly, SearchMode.

DEFile
field_alias (Optional) Dialog Reference

Option to set field alias.

GPBoolean
field_visible (Optional) Dialog Reference

Option to set field visibility.

GPBoolean
field_read_only (Optional) Dialog Reference

Option to set field read only.

GPBoolean
field_search_mode (Optional) Dialog Reference

Option to set field search mode.

GPBoolean
input_project (Optional) Dialog Reference

The Pro project to read maps from. Leave blank to use the active project.

DEFile
field_order (Optional) Dialog Reference

Option to set field order in the map.

GPBoolean

Code Samples

SetFieldPropsFromCSV example 1 (Python window)

Use this tool to set the field properties from a csv

import arcpy

arcpy.udms.SetFieldPropsFromCSV("editor_map", "D:/data/fieldreport.csv", True, True, True, True, "D:/data/pro.aprx")

SetFieldPropsFromCSV example 2 (stand-alone script)

Use this tool to set the field properties from a csv

import arcpy

input_project = "D:/data/pro.aprx"
map_name = "editor_map"
csv_file = "D:/data/fieldreport.csv"
set_alias = True
set_visible = True
set_read_only = True
set_search_mode = True

arcpy.udms.SetFieldPropsFromCSV(
    input_project=input_project,
    map_name=map_name,
    csv_file=csv_file,
    field_set_alias=set_alias,
    field_set_visible=set_visible,
    field_set_read_only=set_read_only,
    field_set_search_mode=set_search_mode,
)