ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Make Table View

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Creates a table view from an input table or feature class. The table view that is created by the tool is temporary and will not persist after the session ends unless the document is saved.

Usage

  • This tool is commonly used to create a table view with a selected set of attributes or fields.

  • ArcCatalog does not display these table views, but they can be used as inputs to other geoprocessing tools in the current ArcGIS session. Once the ArcGIS application is exited, the table views are deleted.

  • Table views created in ArcCatalog cannot be used in ArcMap.

  • If an SQL expression is used but returns nothing, the output will be empty.

  • Field names can be given a new name by using the Field Info control. The second column on the control lists the existing field names from the input. To rename a field, click the field name and type in a new one.

    New field names defined in the Field Info control will be honored in subsequent tools. However, if this tool is the last tool in a model, the field names will be obtained from the source data on disk. To maintain new field names, the new layer has to be written out to a new data using Copy Rows or Copy Features tools.

  • The field names will be validated by specifying an input workspace. Thus, if the input is a geodatabase feature class, and the output workspace is a folder, the field names may be truncated, since shapefile attributes can only have names of ten characters or less. The new names may be reviewed and altered using the Field Info control.

  • A subset of fields can be made unavailable in the new layer by using the Field Info control's visible property. The third column in the control provides a dropdown option to specify whether a field will be visible or hidden in the new layer. The default is TRUE. Selecting FALSE will hide that field. You cannot use the hidden fields in a workflow if the newly created layer is input to a subsequent process or tool. If the output is saved to disk, only the fields listed as visible will appear in the new data.

  • The split policy option on the Field Info control does not apply to this tool.

Syntax

MakeTableView_management (in_table, out_view, {where_clause}, {workspace}, {field_info})
ParameterExplanationData Type
in_table

The input table or feature class.

Table View;Raster Layer
out_view

The name of the table view to be created.

Table View ;Raster Layer
where_clause
(Optional)

An SQL expression used to select a subset of features. For more information on SQL syntax see the help topic SQL reference for query expressions used in ArcGIS.

SQL Expression
workspace
(Optional)

The input workspace used to validate the field names. If the input is a geodatabase table and the output workspace is a dBASE table, the field names may be truncated, since dBASE fields can only have names of ten characters or less. The new names may be reviewed and altered using the field information control.

Workspace
field_info
(Optional)

Specifies which fields from the input table to rename and make visible in the output table view.

Field Info

Code sample

MakeTableView example 1 (Python window)

The following Python window script demonstrates how to use the MakeTableView function in immediate mode.

import arcpy

arcpy.MakeTableView_management("C:/data/input/crimefrequency.dbf", "crimefreq_tview")
MakeTableView example 2 (stand-alone script)

The following stand-alone script demonstrates how to use MakeTableView with a FieldInfo object to filter fields in the output.

# Name: MakeTableView_Example2.py
# Description: Uses a FieldInfo object to select a subset of fields and renaming one field's name.

# Import system modules
import arcpy

# Set data path
intable = "C:/data/tables.gdb/crimefreq"

# Get the fields from the input
fields= arcpy.ListFields(intable)

# Create a fieldinfo object
fieldinfo = arcpy.FieldInfo()

# Iterate through the fields and set them to fieldinfo
for field in fields:
    if field.name == "FREQUENCY":
        fieldinfo.addField(field.name, "NEWFREQ", "VISIBLE", "")
    elif field.name == "CRIME_CAT":
        fieldinfo.addField(field.name, field.name, "HIDDEN", "")
    elif field.name == "BEAT":
        fieldinfo.addField(field.name, field.name, "VISIBLE", "")

# The created crime_view layer will have fields as set in fieldinfo object
arcpy.MakeTableView_management(intable, "crime_view", "", "", fieldinfo)

# To persist the layer on disk make a copy of the view
arcpy.CopyRows_management("crime_view", "C:/temp/newfreq.dbf")

Environments

  • Current Workspace

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Layers and Table Views toolset
  • Using layers and table views
  • Working with layers and table views
  • Building a query expression
  • SQL reference for query expressions used in ArcGIS

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal