DBGETPROP( ) Function Example

The following example displays the name of the primary key field for the customer table. It then displays the field comments for the cust_id field in the customer table. If there are no comments for the field, a message is displayed indicating there are no field comments. To add comments, see the example for DBSETPROP( ).

CLOSE DATABASES
CLEAR

OPEN DATABASE (HOME(2) + 'Data\testdata')

* Displays the primary key field
cResults = DBGETPROP("customer", "Table", "PrimaryKey")
=MESSAGEBOX(cResults)   && Displays    'cust_id'

* Displays comments for the field 'cust_id'
cResults = DBGETPROP("customer.cust_id", "Field", "Comment")
IF LEN(ALLTRIM(cResults)) = 0
   =MESSAGEBOX("No Comment for this field." + CHR(13) + ;
     CHR (13) + "Use DBSETPROP( ) to add comments.")
ELSE
   =MESSAGEBOX("Cust_id field comments: " + cRESULTS)
ENDIF