BBjFileInfo::getKeyInfo

Description

In BBj 6.0 and higher, this method retrieves one or more BBjKeyInfo objects from a BBjFileInfo object.

Syntax

Return Value

Method

BBjVector

getKeyInfo()

BBjKeyInfo

getKeyInfo(int keynum)

BBjKeyInfo

getKeyInfo(string keyname)

Parameters

Variable

Description

keyname

Specifies the key name.

keynum

Specifies the key number.

Return Value

Returns either a BBjVector containing all BBjKeyInfo objects associated with the file or a single BBjKeyInfo object for the specified key chain.

Remarks

This method throws an !ERROR=13 if the file associated with this BBjFileInfo object is not a VKEYED file, or an !ERROR=11 if there is no key chain associated with a specified key name.

Example

rem ' Retrieve KeyInfo from a multi-keyed file

filename$ = "Sample.dat"
erase filename$,err=*next
vkeyed filename$,[1:1:6]+[2:1:3],[3:1:2],0,64
channel = unt
open (channel)filename$
BBjFileInfo! = BBjAPI().getFileSystem().getFileInfo(channel)

rem ' Associate names with keys
BBjFileInfo!.setKeyName(0,"OrderNumber")
BBjFileInfo!.setKeyName(1,"Salesperson")
print 'lf',"Retrieve a KeyInfo by number:"
BBjKeyInfo! = BBjFileInfo!.getKeyInfo(0)
print "Key Number 0 = ",BBjKeyInfo!
print 'lf',"Retrieve a KeyInfo by name:"
BBjKeyInfo! = BBjFileInfo!.getKeyInfo("Salesperson")
print "Key Name Salesperson = ",BBjKeyInfo!
print 'lf',"Retrieve all KeyInfos: ",
BBjKeyInfos! = BBjFileInfo!.getKeyInfo()
print BBjKeyInfos!
keys = BBjKeyInfos!.size()
for keynum = 0 to keys-1
    BBjKeyInfo! = BBjKeyInfos!.get(keynum)
    print "Key Number",keynum," = ",BBjKeyInfo!
next keynum
end

See Also

BBjAPI

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.