pass total rows to func