each to each_value; remove unused vars
Merge pull request #10127 from vipulnsward/each_to_each_value

each to each_value; remove unused vars
Avoid iterating over records hash when not necessary

If the reflection scope is not flagged with distinct value, there is no
need to iterate over the records, so we avoid that by doing the check
before iterating rather than inside the iteration block.