count function for scduleid