Count entries in get data only when needed

This is based on master, same as derived value pull request.  But if derived value goes in first, then master branch will be different, and extract.php will be different, so will it merge cleanly?  The changes in extract.php are to different parts of the file.