getfieldproperties(
getfieldproperties(
DATABASE
,
FIELDNAME
)

The getfieldproperties( function returns a dictionary containing all of the properties of the specified field. (See the setfieldproperties statement if you want to change one or more field properties.)

Parameters

This function has two parameters:

database – The name of the database containing the field you want information about. If the field is in the currently active database, this parameter can be `""` or can even be omitted entirely.

fieldname – The name of the field you want information about. The name can be quoted or left unquoted. If you want information about the current field this parameter can be `""` or can even be omitted entirely. You can also specify the field numerically: 1 for the leftmost field, 2 for the second field from the left, etc.

Description

This function returns a dictionary (see initializedictionary(, getdictionaryvalue( and listdictionarykeys() that contains all of the properties of the specified field – its name, type of data, width, patterns, etc. Everything you could possibly know about a field is returned by this function.

#### Specifying the Field

The getfieldproperties( function may have two, one or zero parameters. Use two parameters to find information about any field in any open database:

    getfieldproperties(database,fieldname)

For example:

    getfieldproperties("Checkbook","Balance")
    getfieldproperties("Invoices","Date")

If the field is in the currently active database you can leave the database name empty, or even leave the database parameter out entirely. As the final example below shows, the field name does not have to be quoted.

    getfieldproperties("","Address")
    getfieldproperties("Address")
    getfieldproperties(Address)

In some cases it can be more convenient to refer to the field by number. Fields are numbered starting from 1 on the left. This example returns information about the leftmost field in the database.

    getfieldproperties(1)

A shortcut for getting information about the currently active field is to simply omit all parameters, like this:

    getfieldproperties()

#### Field Properties

The result of this function is a dictionary containing all of the properties of the specified field. You can use the dumpdictionary( function to display the entire contents of this dictionary:

    dumpdictionary(getfieldproperties())

The result will be something like this:

    ID=9
    NAME="Price"
    TYPE="Float"
    DIGITS="Float"
    ALIGN="Right"
    WIDTH=5.570000
    DEFAULTS=""
    FORMULA="Quantity*UnitPrice"
    OUTPUTPATTERN="#,.##"
    INPUTPATTERN=""
    CAPITALIZATION="Off"
    SPACEBARTAB="Off"
    CLAIRVOYANCE="Off"
    EDITORMODE="Normal"
    CHOICES=""
    RANGE=""
    DUPLICATES="Yes"
    LINK=""
    READLEVEL=0
    WRITELEVEL=0
    NOTES=""

The `ID` is the field number (fields are numbered from 1 starting from the left).

Use the getdictionaryvalue( function to examine individual field properties.

    getdictionaryvalue(getfieldproperties(),"NAME") ☞ Price
    getdictionaryvalue(getfieldproperties(),"ALIGN") ☞ Right
    getdictionaryvalue(getfieldproperties(),"FORMULA") ☞ Quantity*UnitPrice

#### Using a Variable for the Field Name

Because the name of the field may be quoted or unquoted in this function (as noted in the parameter description above), a special technique is necessary if you use a variable to store the name of the field whose properties are required. If you used the following code, where the field name is extracted from an array of field names and stored in the local variable, fldName,

    fldName = array(FieldNameList,J,cr())
    prop = getfieldproperties("Checkbook", fldName)

you would get an error message because Panorama would be looking for a field called fldName and it wouldn’t find one. You need to indicate to Panorama that fldName is not the field name but is a formula that will produce the field name. This is done by replacing the single identifier, fldName, with a string that is obviously a formula. Any formula which produces the required field name will do the job but the simplest solution is to add an empty string to the variable:

    fldName = array(FieldNameList,J,cr())
    prop = getfieldproperties("Checkbook", ""+fldName)

Panorama then evaluates the formula, `""+fldName` and obtains the name of the field.

As a general rule, this technique is necessary whenever you wish to use a variable to store the name of a field passed as a parameter to a statement or function in which the field name parameter may be either quoted or unquoted. These include the datavalue(, fieldalignment(, fieldformula(, fieldnumber(, fieldpattern(, fieldwidth( and grabfieldtype( functions, and the dozen or so lookup( functions whose parameters include a field name.

See Also

- addfield -- adds a new field to the current database (on the end).
- Adding New Fields -- adding one or more fields to a database.
- autoallfieldwidths -- automatically sets the width of all fields based on the data in each field.
- autofieldwidth -- automatically sets the width of the current field based on the data in it.
- Automatic Field Calculations -- performing formulas automatically when data is entered into a field.
- Automatic Field Code -- running a short program when data is entered into a field.
- automaticfieldchoices -- updates the current field's Choice list with actual data in the database.
- automaticfieldname( -- returns an available field name.
- cell -- enters a value into the currently active field (i.e. cell).
- checkdesignlock -- checks if field structure can be changed, if not, returns an error.
- commonfieldspopup -- pops up a list of common fields, and changes the current field specifications when a field is chosen from this menu.
- Construct Multiple Fields -- using a template to quickly add multiple fields to a database.
- constructfields -- creates one or more new fields based on a template.
- databaseconsoledump -- dumps the raw contents of the specified database to the console in comma delimited format.
- Date Patterns -- control how dates are displayed or converted to text.
- Dates -- working with dates.
- dbinfo( -- gets information about a database: what forms it contains, what fields, what flash art pictures, etc.
- deletefield -- deletes the current field from the database.
- Deleting Fields -- deleting fields from the database.
- Disable Editing of Individual Fields -- disable editing of inidividual database fields in the data sheet and/or forms.
- disablefieldediting -- disables editing for a specified list of database fields (all others are enabled).
- editfield -- begins editing of the specified field.
- editfieldname -- opens the data sheet window's field properties inspector and selects the field name.
- Field Blueprint Dialog -- examining and modifying the raw specification of a field.
- Field Properties -- available field attributes.
- Field Properties Panel -- examining and modifying field attributes.
- Field Width -- adjusting the width of a field in the data sheet.
- fieldalignment( -- returns the alignment of a database field.
- fieldformula( -- returns the formula associated with a database field.
- fieldname -- changes the name of the current field.
- fieldnumber( -- returns the number of a database field (starting with 1).
- fieldpattern( -- returns the output pattern associated with a database field.
- Fields -- introduction to database fields.
- fieldtype -- changes the data type of the current field.
- fieldtypes -- returns a carriage return delimited array with list of fields and field data types.
- fieldtypes( -- returns a carriage return delimited array with a list of the fields and field data types.
- fieldwidth( -- returns the width (in the data sheet) of a database field.
- findreplacedialog -- opens the Find & Replace dialog.
- firstcolumn -- moves to the first column in the data sheet (leftmost column).
- hiddenfields( -- returns a list of hidden fields in the curent data sheet window
- hidecurrentfield -- hides the current field in the data sheet.
- hidefieldsbetween -- shows all fields except those in between specified numbers.
- hidelineitemfields -- hides all line item fields.
- hidethesefields -- hides specific fields in the data sheet, making all others visible.
- Hiding and Showing Fields -- temporarily hiding fields in the data sheet.
- info("datatype") -- returns the data type of the current field.
- info("disabledfields") -- returns a list of disabled fields in the current database (fields that cannot be edited).
- info("enabledfields") -- returns a list of enabled fields in the current database (fields that can be edited).
- insertfield -- inserts a new field into the database in front of the current field.
- lastcolumn -- move to the last column in the data sheet (rightmost column).
- Limiting the Maximum Number of Data Sheet Columns -- adjusting the maximum number of columns displayed in data sheet windows.
- Line Item Fields -- are used for repeating items within a record
- mergefieldsdialog -- opens the standard *Merge Fields* dialog.
- Merging Adjacent Fields -- merging two fields into one.
- movefieldbefore -- moves the current field to a new position.
- newdatabasewithfields -- creates a new database with one or more fields.
- newdatabasewithtemplate -- creates a new database with a template.
- Numeric Data -- numeric data (fixed and floating point).
- Numeric Patterns -- control how a number is displayed or converted to text.
- Rearranging Field Order -- rearranging the order of fields in the data sheet.
- reorderfieldsdialog -- opens the Reorder Fields dialog.
- serverdatabaseconsoledump -- dumps the raw contents of the specified database on the server to the console in comma delimited format.
- setfieldnames -- changes the names of all database fields at once.
- setfieldproperties -- modifies one or more properties (name, data type, formula, etc.) of the current field.
- showallfields -- makes every field in the data sheet visible.
- showcolumns -- forces Panorama to display specified fields.
- showfields -- forces Panorama to display specified fields.
- showfieldsbetween -- hides all fields except those in between specified numbers.
- showhidefieldsdialog -- opens the standard Show/Hide Fields dialog (in the Fields menu).
- showthesefields -- makes specific fields in the data sheet visible, hiding all others.
- Smart Dates -- keyboard entry of dates.
- splitfielddialog -- opens the standard *Split Field* dialog.
- Splitting a Field -- splitting a field into two fields.
- tokenname( -- returns the name of a field or variable (instead of the value contained in the field or variables).
- visiblefieldnumbers( -- returns a data array of visible fields (by number) in the data sheet.
- visiblefields( -- returns a list of visible fields in the data sheet.

History

Version | Status | Notes
10.2 | Updated | Now returns the LINEITEM property, if the field is a line item this is the root name of the line item (without the numeric suffix).
10.0 | New | New in this version.