count the number of data items by using controller