Cursor Functions

Creating a Query Specification Frame

querySpecFrame is a frame that specifies the retrieval criteria for entries. It can also indicate the order in which to retrieve them. You do not, however, have to place restrictions on a query. Creating a query using a nil query frame will return every entry in the soup:

unionsoup:Query(nil)
Here is a list of the possible slots in querySpecFrame:

indexPath
Optional. Specifies an existing index (a slot symbol or array of symbols). Entries are sorted by this index.

beginKey
Requires an indexPath slot. The first entry returned has an indexed slot value greater than or equal to the value of beginKey.

beginExclKey
Requires an indexPath slot.The first entry returned has an indexed slot value strictly greater than the value of beginExclKey.

endKey
Requires an indexPath slot.The last entry returned has an indexed slot value less than or equal to the value of endKey.

endExclKey
Requires an indexPath slot.The last entry returned has an indexed slot value strictly less than the value of endExclKey.

indexValidTest
Requires an indexPath slot. This function takes an index value (or array of index values in the case of a multislot index) and returns true or nil. The index value of each potential query entry is passed to this function. If it returns nil, the entry is not part of the query; otherwise, it is. Each time the cursor is moved, validTest is called.

words
This slot contains an array of strings. The query only accepts entries with strings that match each of the array strings.

entireWords
Requires a words slot.If this slot is true, the words array is used for exact string matching rather than as string prefixes.

text
The value is a string. An entry will qualify for this query if it has a string containing text's value in it. The text can be anywhere in the string.

validTest
This function takes an entry and returns true or nil. Each potential query entry is passed to this function. If it returns nil, the entry is not part of the query; otherwise, it is. Each time the cursor is moved, validTest is called.

tagSpec
This slot contains a tag specification frame.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996