home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: GetSet.quickfile 1.8 (26 May 2000 14:59:51) by M Andre Z Eckenrode
-
- Sets <field2> to value retrieved from <field1> in all records in the current
- index.
-
- Requires QuickFile v3.24 or higher, (rexx)reqtools.library and the following
- external function macros:
-
- FixQuotes.quickfile
- ReSort.quickfile
- ProgressWin.quickfile
- GetViewWin.quickfile
-
- */
-
- options results
-
- lib = 'rexxreqtools.library'
- if ~show(l,lib) then call addlib(lib,0,-30)
-
- lf = d2c(10)
- pre = 'Select field to'
- body.1 = 'retrieve value(s) from...'
- body.2 = 'set with value(s) from field'lf
- gads = '_Ok'
- title = 'GetSet.quickfile'
- eztag = 'rtez_flags = ezreqf_centertext'
- tags = eztag
-
- do i = 1 to 2
- body = pre body.i
- if i = 2 then body = body'«'fld.1'»...'
- call notify
- if i = 1 then reqfield
- else reqfield nocalc
- if rc = 5 then exit
- fld.i = upper(result)
- end
-
- numrecs
- recs = result
-
- body = 'Setting field'lf'«'fld.2'»'lf'to value(s) of field'lf'«'fld.1'»'lf'in' recs 'record(s).'lf'Are you sure?'
- gads = '_Yes| _No'
- tags = eztag'|ezreqf_noreturnkey'
- call notify
- if choice = 0 then exit
-
- ndx = 'arexx/resort'(fld.2)
- parse var ndx code ' ' ndx
- if code > 1 then exit
- else if code = 1 then do
- body = 'All available fields to be modified.'lf'No unused field to re-sort database with.'lf'Records may be operated on inconsistently.'
- gads = '_Proceed| _Exit '
- call notify
- if choice = 0 then exit
- end
-
- soi = -1*(recs-1)
- next '"'soi'"'
-
- esc = d2c(27)
- line = ' Working...Record '
- winspec = 'arexx/progresswin'(length(line)+(2*length(recs))+4,title)
- call open(1win,winspec,'w')
- call writech(1win,esc'[0 p'lf||line)
-
- ups = 0
- noups = 0
- do i = 1 to recs
- call writech(1win,esc'[2;20f'i 'of' recs)
- getfield '"'fld.1'"'
- fldval = result
- if pos('"',fldval) > 0 then fldval = 'arexx/fixquotes'(fldval)
- putfield '"'fld.2'" "'fldval'"'
- updrec
- if rc = 0 then ups = ups+1
- else noups = noups+1
- next
- end
-
- call close(1win)
- setindex '"'ndx'"'
-
- refresh
- body = 'Completed!'lf||ups 'record(s) updated successfully.'lf'Update failed for' noups 'record(s).'
- gads = '_Done'
- tags = eztag
- call notify
- exit
-
- notify:
- choice = rtezrequest(body,gads,title,tags)
- return
-