Inside Activate
Jobs and Tasks
Using Job Collection
5 min
overview jobcollection loadquery allows you to load a filtered set of jobs by supplying a query condition that is evaluated in the same way as a sql where clause this method is commonly used in scripts and custom logic where job data needs to be queried programmatically how loadquery works the query string passed to loadquery represents the where portion of a sql query any condition that is valid in a sql where clause can be used, provided the referenced fields exist on the job object a maximum result count is supplied to limit the number of jobs returned basic syntax jobcollection jobs = jobcollection loadquery("\<where clause>", \<maxresults>); where clause defines the job filtering logic maxresults limits the number of jobs returned example date based query the following example retrieves up to 1000 jobs with a status value of 3 that were submitted before a specific date jobcollection jobs = jobcollection loadquery( "status = 3 and submittime < '21 apr 2019'", 1000 ); common use cases jobcollection loadquery is typically used to retrieve historical jobs for reporting or processing find jobs in a specific state or status perform bulk operations against filtered job sets notes and considerations ensure date formats are valid for the underlying sql engine use result limits to avoid loading excessive numbers of jobs test queries carefully before running them in production scripts