home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
t
/
tech91.zip
/
TI682.ASC
< prev
next >
Wrap
Text File
|
1991-08-26
|
4KB
|
199 lines
PRODUCT : Paradox NUMBER : 682
VERSION : 2.0 & up
OS : DOS
DATE : August 26, 1991 PAGE : 1/3
TITLE : CONVERTING TEXT FIELDS TO INITIAL CAPS
Here is a script which will change words with all upper case
letters to a capitalized word (first letter capitalized only).
For instance your data currently reads "ED SMITH" but you want it
to read "Ed Smith". To accomplish this perform the following
actions:
From your main menu select <F10> {Scripts}/{Editor}/{Create} and
type the word CAPS and press <ENTER>. On the screen which
follows, type the following code:
;==============================================================
EDIT "Table_Name"
MOVETO [Field_Name]
SCAN
[]=FORMAT("CC", LOWER([]))
ENDSCAN
MESSAGE
"Press [F2] to save. Any other key to CANCEL changes."
x = GETCHAR()
IF x = -60 THEN ; -60 equals "F2"
DO_IT!
ELSE
CANCELEDIT
ENDIF
;==============================================================
Then select <F10> and {DO_IT!}
To play the script, select <F10> {Scripts}/{Play}, type CAPS and
press <ENTER>. An explanation of the above script follows, so
you can understand it and learn to modify it to better suit your
exact needs.
PRODUCT : Paradox NUMBER : 682
VERSION : 2.0 & up
OS : DOS
DATE : August 26, 1991 PAGE : 2/3
TITLE : CONVERTING TEXT FIELDS TO INITIAL CAPS
Comments:______________________________________________
EDIT "Table_Name" Selects the table in Edit Mode. Replace the
word Table_Name with the actual name of your
table. Do not forget to type in the
quotation marks.
MOVETO [Field_Name] Selects the field. Replace the word
Field_Name with the name of the field which
contains the data to be changed. Do not
forget the square brackets.
SCAN Tell Paradox to step through the table record
by record and perform the following
functions.
[]=FORMAT("CC",LOWER([])) The LOWER function inside the
FORMAT
function will change each word in the current
field to lower-case. The "CC" part of the
FORMAT function then changes the first letter
in each word in the field to upper case.
ENDSCAN Ends the SCAN loop.
MESSAGE The MESSAGE command places a message on
the screen for the user to respond to.
X=GETCHAR() This accepts one character from the
keyboard. The program will wait here
until a key is pressed. See also the
related WAIT command in the PAL Guide.
IF X=-60 THEN DO_IT!If the <F2> key is pressed, the changes to
the table will be saved.
ELSE CANCELEDIT If ANYTHING else is pressed, the edit will be
canceled and the changes lost.
ENDIF This closes the IF statement.
PRODUCT : Paradox NUMBER : 682
VERSION : 2.0 & up
OS : DOS
DATE : August 26, 1991 PAGE : 3/3
TITLE : CONVERTING TEXT FIELDS TO INITIAL CAPS
Final Remarks:
Everything in the script after the ENDSCAN statement can be left
out if the user chooses. However if this is done, the user must
remember to either press <F2> or <F10> {DO_IT!} after playing the
script, or enter the line:
DO_IT!
after the ENDSCAN statement to save the changes the script has
made to the table. If you do not wish to save the changes after
seeing them (if you have removed the lines after ENDSCAN), then
you must select <F10> {Cancel}/{Yes}.