The access() function provides data about the AQL or Update Processor environments when the program is called from a dictionary.
Syntax
access(num.exp) |
Description
The access() function can only be used in subroutines that are called from a dictionary item when in AQL or the Update Processor and allows information about the controlling environment to be read and altered by the subroutine.
Parameter(s)
num.exp |
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 that 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 AQL reports. |
|
10 |
Item-ID. |
|
11 |
Dictionary and data file names. NOTE— If the dict and data file names are identical, only the data filename is returned. |
|
12 |
Item delete bit. Returns 1 if the item is being deleted. |
|
13 |
Root variable. |
|
14 |
Returns current cursor column position (in the Update Processor). |
|
15 |
Returns current cursor row position (in the Update Processor). |
|
16 |
New item bit. Returns 1 if item is new. |
|
17 |
Returns 1 if performing 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 that ended the last input, usually an Enter, CTRL+U, and so on. |
|
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 |
Used from a FlashBASIC subroutine called by the Update Processor to place characters in the Update Processor 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 nonzero (usually 1) if the spelling checker is enabled, or 0 if it is not. access(22) can 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 only works on attributes with an attribute type of w. |
|
23 |
Returns the calling environment.
|
|
24 |
Returns the actual attribute number of the attribute definition. Available only within the Update Processor. |
|
25 |
Returns the left margin from the Update Processor. |
|
26 |
Returns 1 if a callx was initiated from a clear-file operation. 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. |
|
27 |
Returns the name of the account containing the D-pointer for the file from which the BASIC program was called via a trigger or a call from a correlative. |
|
50 |
Returns 1 if the item was in UNICODE. NOTE—FlashBASIC does not currently support UNICODE, therefore the item is converted to ANSI and back to UNICODE after the trigger completes. |
The access(3) and access(10) functions can be used to pass data both ways between a FlashBASIC or BASIC program and a data file.
When either of these two statements display on the right of the = assignment operator, data is passed to the program. When they are used to the left of the = assignment operator, 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 Update Processor using input-conversion or correlative attributes in dictionary items.
All of the access() functions share a common buffer. It is not currently possible to combine references to AQL elements on the same line. For example:
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 BASIC 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 performing the operation by calling a BASIC program. However, performing any complex logical processing or out-of-context work is best done in a subroutine.
Example(s)
The program below 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+ZP, which redisplays 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 the Update Processor as it does for AQL to extract the last element of a value (or subvalue) list. The date stamp is attribute 11 of the item. max is the total number of MultiValue elements on the stamp. If max is 0, there is no stamp. If max is nonzero, 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 |
See Also
call Processing Code, callx (Write Trigger) Processing Code, File-Defining Items, FlashBASIC C Function Overview, Spell Checking Commands, speller Command, Statements and Functions, subroutine Statement, words File