home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
database
/
p4w_all.zip
/
TI1284.ASC
< prev
next >
Wrap
Text File
|
1993-03-03
|
4KB
|
133 lines
PRODUCT : Paradox for Windows NUMBER : 1284
VERSION : 1.0
OS : WIN
DATE : March 3, 1993 PAGE : 1/2
TITLE : Adding Leading Zeros to a Zipcode Field
This document illustrates how to add leading zeros to a zipcode
field that is formatted as a numeric data type. Fields that are
formatted with numeric data types do not retain leading zeros.
In order to have zipcode fields that contain zipcodes with
leading zeros, the zipcode field must be formatted as an
alphanumeric data type. The following steps illustrate how to
restructure a table and change the data type of a zipcode field
from numeric to alphanumeric, and how to add leading zeros to
records that have three or four numbers in the zipcode field.
Before making global changes to your table, it is a good idea to
first make a backup copy.
1. Change the data type of the Zipcode field from numeric to
alphanumeric.
a. Select File | Utilities | Restructure, choose a
table name from the Select File list or type in a
table name, then left-click on OK or press Enter.
b. Change the Type of the Zipcode field from N to A,
change the Size area of the Zipcode field to 10,
then left-click on Save or press Alt+S to save.
c. In the Restructure Warning dialog box, choose OK
2. Create a query for your table
a. Select File | New | Query, left-click on your table
name from the Select File list, then choose OK.
b. In the first line of the query in the Zipcode
field, press F5, then type: 4, @@@@, changeto
followed by a space (make sure you follow each
comma with a space).
c. Still in the Zipcode field, type "0", type +, press
F5, and type 4.
d. In the second line of the query in the Zipcode
field, press F5, then type: 3, @@@, changeto
followed by a space (make sure you follow each
comma with a space).
PRODUCT : Paradox for Windows NUMBER : 1284
VERSION : 1.0
OS : WIN
DATE : March 3, 1993 PAGE : 2/2
TITLE : Adding Leading Zeros to a Zipcode Field
e. Still in the Zipcode field, type "00", type +,
press F5, and type 3.
Your query should look like the example below:
CUSTLIST╔═══════Zipcode══════════════╗
║ _4, @@@@, changeto "0"+_4 ║
║ _3, @@@, changeto "00"+_3 ║
The "-" preceding 4 and 3 represents an example element.
3. Run the Query by clicking the Lightning Bolt or press F8.
When Paradox finishes the query, it displays the Changed
table on the Desktop. Now open the table that you queried
to view the changes (in this example you would view the
table "Custlist"). Records that had only three numbers in
the Zipcode field will now have two leading zeros
preceding the three numbers. Records that had only four
numbers in the Zipcode field will now have one leading
zero preceding the four numbers.
Suggested Reading:
Restructuring tables: Chapter 9, User's Guide
Changeto queries: Chapter 6, User's Guide
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.