modified retrievedata.jag to schedule query