Xbasic

DICTIONARY.OPEN Function

Syntax

P Open([C data_dictionary_name[,N file_open_mode]])

Arguments

data_dictionary_name

Character

file_open_mode

Numeric

Description

Open an existing data dictonary.

Discussion

The DICTIONARY.OPEN() method opens the data dictionary for the current table or set, returning a table pointer for the data dictionary file. Use this method to obtain information about the dictionary objects stored for a table or set. For example, you can collect the names of available form and browse layouts, and determine if field rules exist for a field. The data dictionary is open in read-only mode ( FILE_RO_SHARED ), and cannot be modified directly. To close the data dictionary file, use the <TBL>.CLOSE() method as you would for any other table. Note : You can only open the dictionary for the primary table or set in a session.

Example

Open the dictionary and display a list box showing all of the forms for the table. Open the form that the user selects.

dim names[40] as C
tbl = dictionary.open()
range.flags = range_index .or. range_filter
range.index_pointer = tbl.index_record_get()
range.filter = "type = 'FRMI'"
tbl.range_add()

Populate an array with form names.

count = 0
tbl.fetch_first()
while .not. tbl.fetch_EOF()
    count = count + 1
    names[count] = tbl.name
    tbl.fetch_next()
end while
tbl.close()

Display names for user to choose and then call the form.

form_name = ui_get_list_array("Choose a Form",1,"names")
if form_name = "" then
    end
end if

Trim form_name to remove trailing spaces.

form.view( alltrim(form_name) )

Open the dictionary and display a list box showing all of the queries for the table. Run the query that the user selects.

dim names[40] as C
tbl = dictionary.open()
range.flags = range_index .or. range_filter
range.index_pointer = tbl.index_record_get()
range.filter = "type = 'QBES'"
tbl.range_add()

Display names for user to choose and then run the query.

query_name = ui_get_list_array("Choose a Query",1,"names")
if query_name = "" then
    end
end if
tbl = table.current()
tbl.Query_Primary_Put(query_name)
parent.resynch()

See Also