Community and Regional Planning Program
The University of Texas at Austin School of Architecture

ArcView Tips Table of Contents

Working with tables in and out of ArcView



Overview

Attributes for ArcView data sets depend on what type of  geographic data set you are using:

Geographic Data Set Attributes are stored in:
Arc\Info coverage info directory
ArcView shape file dBase (.dbf) file

To export data from ArcView to a spreadsheet or database program:

If your attribute data is already in dBase format (e.g., for building attributes, you have a building.dbf file), you can bring that file directly up in most spreadsheet and database programs. A theme based on a shape file (.shp) stores its attributes in a dBase file (.dbf)

Attributes stored in an INFO directory cannot be brought up directly in a spreadsheet or database. You must export this data to dBase first. If your attribute data is in INFO format (e.g., for buildings, you have a Arc/Info-style coverage in which there is a buildings directory with an accompanying INFO directory), you can export the attribute data into dBase by:

  1. Adding the theme to a view and making it the active theme (e.g., buildings)
  2. Opening the theme attribute table (e.g., attributes of buildings)
  3. Select FILE-EXPORT from the Table menu and choose dBase format
  4. Choose a location and name for the new file (e.g., buildings.dbf in your personal directory)

Using data from a spreadsheet or database in ArcView

ArcView uses dBase files directly without any special import.  Most spreadsheet and database programs can save files in dBase format (usually you choose File-Save, then choose dBase (.dbf) as the format.  If given a choice, choose dBaseIV.  Before doing this, make sure your field names are dBase compliant: 10 characters maximum in length, no spaces.

See Saving Excel files in dBase format for specific information about doing this in Excel.

Manipulating fields so that they will join in ArcView

To join two tables in ArcView, you must have one field shared in common.  The field name can be different in each table, but the field type must be the same and the field values must match. For example, to join a table with STF3 census data at the block group level to our 1990Census blockgroup theme attribute table, you must find a field they share in common. In the example below, the STF3 table is on the right (320newb.dbf).  The field most closely shared in common is the Name field in the "Attributes of Blkgrp" table and the Id field in the "320newb.dbf" table. However the later has a "BG" in front of the block-group ID.  Before you can join, you must get rid of this so that the fields match up exactly. At this point we are also unsure if the field type is the same (to do this, see How to determine field types and other properties in ArcView).

To manipulate the field values in ArcView, you can do the following, using the "320newb.dbf" example above:

  1. Open the the "320newb.dbf" table and make it the active table
  2. Choose Table-Start Editing from the Table Menu
  3. Add a new field (Edit-Add Field).  Call it Name, make it a string type field and make it 13 characters in width (so that it will include all 13 characters, including the decimal point after we have lopped off the "BG")
  4. Select all the records in "320newb.dbf" (Edit-Select All)
  5. Make the new Name field the active field by clicking on Name
  6. Press the calculate icon from the Table Menu (or Field-Calculate).
  7. Choose [Id] from the Fields list, string from the Type list, and Right from the Requests list
  8. Because you want the rightmost 13 characters, type 13 between the parentheses after Right [i.e., Right(13)]
    Your form should look like the following:
  9. Press OK - this will fill in all the records with the truncated name
  10. The two tables can now be joined

Note 1: For more information on how to use the Calculate tool to manipulate fields, in ArcView choose Help-Topics, Working with Tabular Data - Creating and Editing a Table - Calculating a Field's Values.  See especially at the end of this help page the links to specific ways to manipulate string, numeric, boolean and date fields.

Note 2: the same process can be accomplished in a spreadsheet or database program - read the online help that comes with the software program you wish to use.

How to determine field type in ArcView

To join tables in ArcView, the two fields shared in common must have the same field type (e.g., string, number, boolean) In the example above I knew that Name field in the "Attributes of blkgrp" table was a string-type field, so I created a table in the other table of the same type and filled in the values using the Calculate tool.  Often you will find that tables won't join properly - if everything else looks ok, the culprit is probably the fact that the two fields are of different types. It is possible to determine the field type of an ArcView table by using an existing script that comes with the software.

To get more information about this script, in ArcView choose Help-Topics, then select "Sample Scripts and Extensions - Sample Scripts - Tables - Displays Field Properties. To see how to use this script in ArcView, select the Help Topic "Sample Scripts and Extensions - How to use the samples".

Once you have copied the script (following the directions in ArcView Help), your screen should look like this:

Before you run the script you must compile it (this changes it from text you can read into machine code that ArcView reads. Compile a script by clicking on the checkmark icon or choosing Script-Compile from the Script Menu.

To run this script successfully, the field name for which you want to know the field properties must be highlighted.  Also, the table containing this field must have been the last active window you were in before running the script. If you do not do this, you will get an error message when you run the script.

To run the script, select the "running man" icon or choose Script-Run from the Script Menu. You should get the results in a new window:

Note: you will notice in the sample scripts many interesting or potentially useful scripts.  Use ArcView's help to learn more about these scripts.  You can write scripts yourself if you learn Avenue, the programming language that allows you to customize ArcView. You can also download scripts from ESRI's web site.


Return to top of page

8 February 1998
The School of Architecture at UT Austin
Comments to: Barbara Parmenter