|Command||basic.access Function/BASIC Program
Applicable release versions: AP, AP 6.1, AP 6.2
|Category||BASIC Program (486)|
|Description||provides data about the Access or UP environment when the program is called from a dictionary.
Access() can only be used in subroutines that are called from a dictionary item when in Access or UP and allows information about the controlling environment to be read and altered by the subroutine.
The following list represents the valid numeric expressions which may be specified in the "access()" function:
1 file.variable for data portion of file.
2 file.variable for dictionary portion of file.
3 Item from the associated file in dynamic array format. If the item is new, this contains "" (null).
4 Item counter (the number of items processed to the current point).
5 Attribute counter (the number of attributes processed).
6 Value counter (the number of values processed).
7 Subvalue counter (the number of subvalues processed).
8 Detail line counter (the number of lines processed).
9 Break-on level counter
11 File name.
12 Item delete bit. Returns 1 if the item is being deleted.
13 Root variable.
14 Returns current cursor column position (in UP).
15 Returns current cursor row position (in UP).
16 New item bit. Returns 1 if item is new.
17 Returns 1 if doing input-conversion.
18 Used in the input-conversion attribute of the file "d-pointer" to specify which value of attribute 15 ("macro" attribute) to use.
19 Returns the character which ended the last input, usually a <return>, <ctrl>+u, etc.
20 Item changed bit (0-item not changed, 1-item changed). This is valid only when called from the Update-Processor using a call correlative.
21 This is used from a Pick/BASIC subroutine called by UP to place characters in the UP command string. For example, access(21) = "xe" in a subroutine called from the input-conversion causes the Update processor to exit after the attribute calling the subroutine is re-entered.
22 Returns a non-zero (usually 1) if the spelling checker is enabled, or 0 if it is not. Access(22) may be assigned a "1" in a subroutine called by the input conversion of a file-defining item. Even if the spelling checker is disabled for the user session, this invokes the speller for the editing of this item or list of items. The speller will only on attributes with an attribute type of "w". See "attribute-type". Access(22) is available in AP releases 5.2.5 and 6.0.0 and higher only.
23 Returns the calling environment. It returns 0 if the function was called from FlashBASIC or Pick/BASIC, 1 if the function was called from a callx or from an index, 2 if the function was called from the Update processor (except for a callx or index), and 3 if the function was called from Access. Access(23) is available in AP releases 6.1.0 and higher only.
24 Returns the actual attribute number of the attribute definition. Available on 6.1.0 and higher only.
25 Returns the left margin from the Update processor (6.2 and above).
The access(3) and access(10) functions can be used to pass data both ways between a Pick/BASIC program and a data file.
When either of these two statements appear on the right of the assignment (= sign), data is passed to the program. When they are used to the left of the assignment, data is passed from the program to the file.
access(3) can be updated only from an input-conversion of a dictionary item. It cannot be updated as a conversion, correlative or in a "d-pointer" input-conversion.
The item-ids as well as the remainder of the attribute values within those items can be modified directly through the UP using input conversion or correlative attributes in dictionary items.
The following program is called from a "hot" key in the Update processor. It gets the current file name from access(11) and executes a special "help" processor. The "access(21)" macro return function is set to <ctrl>+z and p which rediplays the current screen. subroutine do.help(item) file.name = access(11) tcl "help ":file.name access(21)= "z'p'" return This example works as well for Update as it does for Access to extract the last element of a value list. (Or subvalue for that matter). The date stamp is attribute 11 of the item. "max" is the total number of multi-valued elements on the stamp. If "max" is zero, there is no stamp. If max is non-zero, the last value is extracted and placed into the active data value, "fld". subroutine get.last.date.stamp(fld) date.stamp = access(3)<11> max = dcount(date.stamp,char(253)) if max = 0 then return fld = access(3)<11,max> return