SET.OPEN Function


<Set> as P = SET.Open(C setname [,N file_open_mode|SQL::Arguments args [,C encryption key]])



The name of a set. The extension ".set" is assumed.


Optional. Determines the access privileges that apply to the open table file. You can use one of the following system variables:


Read Only (Exclusive)


Read or Write (Exclusive)


Read Only (Shared)


Read or Write (Shared)


Optional. Needed if the table has been encrypted, and the default encryption key has not been set (using the DEFAULT_ENCRYPTION_KEY_SET() function), of if the table was encrypted using a different encryption key than the default encryption key.


Open a set - primary table of set becomes primary table of session. TIP: It is generally better to use set.open_session().


SET.OPEN() opens a set and returns a pointer to the set. Returns the <Set> pointer variable that references the set. See TABLE.OPEN() for a description of the Open Mode and Password parameters.

If you have set a Master Password for your database, and have encrypted tables using the Tools, Security menu, then the default encryption key is automatically set when the database is opened, and you do not need to specify the Password parameter when opening tables.

Once the set has been opened, you can use the <Set> pointer variable to get pointers to the individual tables in the set. The syntax is:

<TBL> = <SET>.alias

where alias is the alias of the table in the set.

If you use the SET.OPEN() method in a script attached to a button or event on a form, it will fail because SET.OPEN() tries to make the primary table of the set the primary table of the session. This is not possible, since the table (or primary table of the set) on which the Form is based is the primary table of session, and you cannot reset the primary table of a session for a Form. For this reason, the SET.OPEN_SESSION() method is more useful, because it can be called from an event on a form.


From the Interactive window:

s ="invoice")
? set.current().filename_get()-> "c:\program files\a5v5\samples\alphasports\invoice.SET"
'get a pointer to the invoice_header table
t1 = s.invoice_header
'get a pointer to the customer table
t2 = s.customer
'move to the last record in the invoice set
'display the matching customer lastname for this invoice
? t2.lastname -> "Graham     "

See Also