Added generic getNumRecords function

Added generic getNumRecords function