Use number of items to iterate through result list.

#6359