home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- PROCEDURE Blankarray
-
- PARAMETERS _tarray, _tfile, _tfield, _length
-
- PRIVATE _retto, _start, _blanka, b_fields, _ngo, _inc, _tempb
-
- IF PCOUNT() = 1
- _tfile = ""
- ENDIF
-
- _start = 1
- _blanka = 1
- IF !EMPTY(_tfile)
- _retto = STR(SELECT())
- IF LEN(_tfile) = 1
- SELECT &_tfile
- ELSE
- SELECT 0
- USE (_tfile)
- ENDIF
- ENDIF
-
- IF PCOUNT() < 4
- _length = LEN(_tarray)
- ELSE
- IF _length > LEN(_tarray)
- _length = LEN(_tarray)
- ENDIF
- ENDIF
-
- IF PCOUNT() > 2
- b_fields = ""
- FOR _ngo = 1 TO FCOUNT()
- b_fields = b_fields + FILL_OUT(FIELDNAME(_ngo), 10)
- NEXT
- _start = (AT(UPPER(Fill_out(_tfield, 10)), b_fields) + 9) / 10
- _length = INT(_length + _start - 1)
- ELSE
- _start = 1
- ENDIF
-
- IF _start <= 1
- _start = 1
- ENDIF
-
- _start = INT(IF(_start <= 1, 1, _start))
- _inc = 1
- *
- * In case a field name is given, the array subscript must point
- * to a different area than the FIELDNAME() subscript. Therefore,
- * as I scran through the fields using the variable '_blanka' as
- * the subscript value, I will use '_inc' as the array sub-
- * script value.
- *
-
- FOR _blanka = _start TO _length STEP 1
- _tempb = FIELDNAME(_blanka)
- _tarray[_inc] = Make_empty(&_tempb.)
- _inc = _inc + 1
- NEXT
-
- IF !EMPTY(_tfile)
- IF LEN(_tfile) > 1
- CLOSE DATABASE
- ENDIF
- SELECT &_retto.
- ENDIF
-
- * End of File