Running Report in adTempus

GuyS (45 posts)
July 22, 2022 03:07 AM
Accepted Answer

Hi Bill,

 

I understand it is not possible to run a scheduled report in adTempus yet. But you suggested a query. Can you help me with that to get the jobhistory of a specific group for this month?

- What would the qurey be?

- How to add it to a job? I suppose I have to create a DB connection with adtempus?

 

Thanks,

Guy

Bill Staff (599 posts)
July 22, 2022 12:54 PM
Accepted Answer

Doing this through the API may be simpler than through a database query. Here is a PowerShell script that gets the history for a job or group for a date range and writes it to a CSV file. Note that the job you run this from has to run under an account with permission to connect to adTempus and view jobs.

If you want to do this through the database, your query is something like this:

select g.name, j.name,jobInstanceID,DATEADD(minute, executionStartTZ, executionstart) as ExecutionStart,DATEADD(minute, executionfinishTZ,executionFinish) as ExecutionFinish, ss.stringText  as status
from  job j  join executionHistoryItem ehi on j.oid = ehi.jobOID 
join StatusStringsEN ss on ehi.status = ss.stringID
join jobGroup g on g.oid = j.jobGroupOID

You can then filter that by group name or OID if you want to hard-code that. If the group has subgroups this will not include jobs from those--you will need to either hard-code the group OIDs into the query or write sql to iterate through the sub-groups.

The adTempus database task can run the query and select the results into a .NET dataset but you would then need to write your own code to output it in whatever format you need. You would need to set up security on the adTempus database so that the account the job runs under has access.