addded logic for quartery in task scheduler