table.FIELD_SPACE_USAGE Function

Syntax

Field_List as C = Field_Space_Usage()

Arguments

Field_List

A CR-LF delimited string in the format <fieldname>, width, decimals.

Description

Visits all records and dumps field name + space used.

Discussion

The <TBL>.FIELD_SPACE_USAGE() method scans all of the data in a table and reports the minimum size needed for each field. For example, if you have defined a character field with a size of 100 but none of the records in this field is longer than 40, then you can safely restructure your table and reduce this field to 40 characters. Note : The function returns 0 for the width of memo fields.

Example 

This script was attached to a button on a form.

dim tbl as P
dim answer as C
tbl = table.current()
answer = tbl.field_space_usage()
ui_msg_box("Minimum Size for Each Field", answer)

See Also