home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Utilities
/
QuickFile
/
ARexx
/
Append.quickfile
< prev
next >
Wrap
Text File
|
1999-12-18
|
2KB
|
63 lines
/*
$VER: Append.quickfile 1.2 (30-Nov-1999 22:00:20) by M Andre Z Eckenrode
Appends or Prepends a string to a string field in all records in the current
index.
NOTE: There is currently no way to tell, via ARexx, whether a given string
field is a calculated field or not.
Requires v3.23 of QuickFile and (rexx)reqtools.library.
*/
options results
numrecs
records = result
soi = -1*(records-1)
next '"'soi'"'
if ~show(l,'rexxreqtools.library') then call addlib('rexxreqtools.library',0,-30)
title = 'Append.quickfile'
tags = 'reqf_centertext'
choice = rtezrequest('Append or Prepend to Field?','Append|Prepend|Cancel',title,'rtez_flags = ez'tags)
if choice = 0 then exit
which.1 = 'Ap'
which.2 = 'Pre'
reqfield
field = result
body = 'Enter string to be' which.choice'pended to contents of field'lf'«'field'»:'
string = rtgetstring(,body,title,' Ok |Cancel','rtgs_flags = gs'tags)
if string == '' then exit
lf = d2c(10)
body = which.choice'pending'lf'"'string'"'lf'to contents of field'lf'«'field'».'lf'Continue?'
goahead = rtezrequest(body,''which.choice'pend|Cancel',title,'rtez_flags = ez'tags)
if goahead = 0 then exit
updates = 0
noupdates = 0
do records
getfield '"'field'"'
value = result
if choice = 1 then newval = value||string
else newval = string||value
putfield '"'field'" "'newval'"'
if rc > 0 then do
body = 'Unable to' which.choice'pend'lf'"'string'"'lf'to contents of field'lf'«'field'».'lf'Is the field type compatible?'
call rtezrequest(body,'Exit',title,'rtez_flags = ez'tags)
exit
end
updrec
if rc = 0 then updates = updates+1
else noupdates = noupdates+1
next
end
refresh
body = 'Completed!'lf||updates 'record(s) successfully updated.'lf'Update
failed for' noupdates 'record(s).'
call rtezrequest(body,'Done',title,'rtez_flags = ez'tags)