getCurrentKeys

getCurrentKeys(keys: ParamListType output);

The getCurrentKeys method of the Iterator class is an abstract method that is implemented only by dictionary iterators.

This method retrieves one or more keys at the current iterator position in the associated dictionary. It can be used to access the keys of an external key dictionary or to access key properties in a member key dictionary from the iterator without having to access the member object itself.

The method can be called with a partial key list; for example, when iterating a dictionary with three keys, you can pass one, two, or three parameters to receive the output. The parameters must be of the same type as the keys or of type Any. If the parameter types do not match the key types or are not of type Any, a runtime exception is raised. The following example shows the use of the getCurrentKeys method.

vars
    iter : Iterator;
    cust : Customer;
    name, city : String;  // variables to receive dictionary key values
begin
    iter := app.myBank.allCustomers.createIterator;
    while iter.next(cust) do
        // retrieve the first key
        iter.getCurrentKeys(name);
        // retrieve the first two keys
        iter.getCurrentKeys(name, city);
    endwhile;
epilog
    delete iter;
end;

When you use the getCurrentKeys method for filtering based on key conditions or populating list views with key data, judicious use of this method may result in performance improvements. (Performance improvements occur when you can avoid fetching objects from the server to access key properties.)

This method can be used as an alternative to the getIteratorKeys of the Dictionary class to avoid share locking the associated dictionary on each call.