next

next(value: Any output): Boolean updating;

The next method of the Iterator class accesses successive entries one at a time in the collection to which the iteration is attached. The value parameter receives the next entry in the collection and must be of the same type as the members in the collection.

This method returns true when it has returned a value or it returns false when the iterator is positioned after the last entry in the collection.

The following examples show the use of the next method.

getRelativePosition(pObj: Object): Integer;
vars
    coll : Collection;
    pos  : Integer;
    obj  : Object;
    iter : Iterator;
begin
    coll := self.getCollection;
    iter := coll.createIterator;
    while iter.next(obj) do
        pos := pos + 1;
        if obj = pObj then
            break;
        endif;
    endwhile;
    return pos;
end;

buttonNext_click(btn: Button input) updating;
begin
    if self.cust <> app.myCompany.allCustomers.last then
        self.iter.next(self.cust);
        listBoxCustomers.listIndex := listBoxCustomers.listIndex + 1;
    endif;
    self.displayInstance;
end;