Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Fields toolset > Tools

Transpose Time Fields (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

Shifts fields in a table or feature class that have time as the field names from columns to rows.
This tool is useful when your table or feature class stores values for each date as multiple columns, where field names might be Year1980, Year1990, Year2000 and so on, and you want to animate your data through time in ArcMap, ArcScene or ArcGlobe. To animate through time you must have one time column only. When a table or feature class is transposed, the string (date value in this case) specified to represent each field name, such as 1980, 1990 and 2000, will be repeated in one field, based on how many locations have values associated with that string.


Illustration

Transpose time fields illustration

Usage tips

Command line syntax
An overview of the Command Line window
TransposeTimeFields_management <Input_Feature_Class_or_Table> <Fields_to_Transpose;Fields_to_Transpose...> <Output_Feature_Class_or_Table> <Time_Field_Name> <Value_Field_Name> {Attribute_Fields;Attribute_Fields...}

Parameter Explanation Data Type
<Input_Feature_Class_or_Table>

The input feature class or table that contains multiple fields that represent different times.

Table View
<Fields_to_Transpose;Fields_to_Transpose...>

Specify the time fields in the table, and how you would like them to be stored in the output table. Input fields can be any format.

Multiple strings can be entered, depending on how many fields you are transposing. Each string should be formatted as "Field_Name Time" (without the quotation marks). Each is a pair of substrings separated by a space. For example, the following string is a valid input - "POP1980 1980". In this example, POP1980 is the field name of a field containing population values for 1980. 1980 is the string that will be substituted for POP1980 and populated in a time field where it is repeated based on how many population values there are for that date in different locations.

String
<Output_Feature_Class_or_Table>

The output feature class or table. The output table can be specified as a .dbf table, an info table, or a geodatabase table. The output feature class can only be stored in a geodatabase (shapefile is not available as a format for the output). The output feature class or table will contain a time field, a value field, and any number of attribute fields specified that need to be inherited from the input table.

Table
<Time_Field_Name>

The name of the time field that will be created to store time values. The default name is "Time". Any valid field name can be set, as long as it does not conflict with existing field names from the input table or feature class.

String
<Value_Field_Name>

The name of the value field that will be created to store the values from the input table. The default name is "Value". Any valid field name can be set, as long as it does not conflict with existing field names from the input table or feature class.

String
{Attribute_Fields;Attribute_Fields...}

Attribute fields from the input table to be included in the output table.

Field
Data types for geoprocessing tool parameters


Command line example

TransposeTimeFields_management C:\Data\test.mdb\fc_or_table_1 ('Y1980 1980';'Y1981 1981';'Y1982 1982') C:\Data\test.mdb\Trans_out Time Value (Field1;Field2)

Scripting syntax
About getting started with writing geoprocessing scripts
TransposeTimeFields_management (Input_Feature_Class_or_Table, Fields_to_Transpose, Output_Feature_Class_or_Table, Time_Field_Name, Value_Field_Name, Attribute_Fields)

Parameter Explanation Data Type
Input_Feature_Class_or_Table (Required)

The input feature class or table that contains multiple fields that represent different times.

Table View
Fields_to_Transpose (Required)

Specify the time fields in the table, and how you would like them to be stored in the output table. Input fields can be any format.

Multiple strings can be entered, depending on how many fields you are transposing. Each string should be formatted as "Field_Name Time" (without the quotation marks). Each is a pair of substrings separated by a space. For example, the following string is a valid input - "POP1980 1980". In this example, POP1980 is the field name of a field containing population values for 1980. 1980 is the string that will be substituted for POP1980 and populated in a time field where it is repeated based on how many population values there are for that date in different locations.

String
Output_Feature_Class_or_Table (Required)

The output feature class or table. The output table can be specified as a .dbf table, an info table, or a geodatabase table. The output feature class can only be stored in a geodatabase (shapefile is not available as a format for the output). The output feature class or table will contain a time field, a value field, and any number of attribute fields specified that need to be inherited from the input table.

Table
Time_Field_Name (Required)

The name of the time field that will be created to store time values. The default name is "Time". Any valid field name can be set, as long as it does not conflict with existing field names from the input table or feature class.

String
Value_Field_Name (Required)

The name of the value field that will be created to store the values from the input table. The default name is "Value". Any valid field name can be set, as long as it does not conflict with existing field names from the input table or feature class.

String
Attribute_Fields (Optional)

Attribute fields from the input table to be included in the output table.

Field

Data types for geoprocessing tool parameters


Script example

# TransposeTimeFields.py
# Description: Shifts fields with time as a field name from columns to rows in a table or feature class
# Requirements: None
# Author: ESRI
# Date: 10/30/05

# Create Geoprocessor object
import arcgisscripting
gp=arcgisscripting.create()

try:
    # Set the workspace
    gp.Workspace =  "c:/data/test.mdb"
    gp.toolbox = "management"

    # Specify input feature class or table
    in_fc_or_table = "state_pop"

    # Specify fields to transpose
    fieldsToTranspose = "'Y1980 1980';'Y1981 1981';'Y1982 1982'"

    # Set a variable to store output feature class or table
    out_fc_or_table = "state_output"

    # Set a variable to store time field name
   timeFieldName = "Time"

    # Set a variable to store value field name
    valueFieldName = "Value"

    # Specify attribute fields to be included in the output
    attrFields = "STATE_NAME;AVG_ANUAL_"

    # Process: TransposeTimeFields
    gp.TransposeTimeFields(in_fc_or_table, fieldsToTranspose, out_fc_or_table, timeFieldName, valueFieldName, attrFields)

except:
    # If an error occurred while running a tool print the messages
    print gp.GetMessages()

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.