| ac.expression | Index Level | ALPHA |
| Syntax | ACCESS( num.expression ) |
| Category | BASIC |
| Type | Function |
| 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 When used from a file-time subroutine, this is the "working" version of the item. When used from an attribute definition call, this is the item from the associated file. In either case, the item is in dynamic array format. Note that when used from a file-time subroutine, this dynamic array has the same contents as the argument which is passed to the subroutine. 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). Valid only when a roll-on clause has been specified. 9 Break-on level counter in Access reports. 10 Item-id. 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 FlashBASIC 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 only on release 5.2.5 and higher. 23 Returns the calling environment. It returns 0 if the function was called from FlashBASIC, 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 only on release 6.1.0 and higher. 24 Returns the actual attribute number of the attribute definition. Available on release 6.1.0 and higher only, and only within the Update Processor. 25 Returns the left margin from the Update processor (release 7.0 and higher). 26 Returns 1 if a callx was initiated from a clear-file operatoin. If the program sets ACCESS(26) to zero during a clear-file, then the callx is not called for any of the other items during that clear-file operation. This can lead to significant performance gains in certain situations (release 7.1 and higher). The access(3) and access(10) functions can be used to pass data both ways between a FlashBASIC 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. |
| Options | |
| See Also | statements & functions call file-defining item SUBROUTINE callx subroutine functions speller speller-off speller-on spelling checker a words aa aaa input-conversion |
| Example |
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 |
| Warnings |
All of the access functions share a common buffer. It is not currently possible to combine references to access elements on the same line:
cmd = "list ":access(11):" ":access(10) does not work, but file = access(11); item = access(10) cmd = "list ":file:" ":item does work. There can be considerably more overhead when calling a FlashBASIC program from a dictionary over using an intrinsic processing code, depending on how complex the processing code has to be. A "simple" code: a3+5 or an(amount)*n(quantity) is much faster than doing the same thing by calling a FlashBASIC program. However, doing any complex logical processing or "out-of-context" work is better off in a subroutine. |
| Compatibility | D3 7.0 D3 7.1 AP AP 6.1 |
| ac.expression | Index Level | ALPHA |