Needful things Part A

Some helpful tiny DQL queries:

Select all Documents which are currently running in a Workflow

select distinct
d.object_name as document_name,
d.r_object_id as doc_identifier,
f.object_name as wfl_name,
f.r_act_name as wf_type,
f.supervisor_name as started_by,
f.r_object_id as wf_id 

from dmi_package p, dm_workflow f, dm_document (all) d
where r_workflow_id in (select r_object_id from dm_workflow)
AND p.r_workflow_id = f.r_object_id
AND p.r_component_id = d.r_object_id
ORDER BY 5 ASC
enable (row_based)

Documents attached to workflow tasks in a user’s Inbox that are overdue

SELECT DISTINCT r_object_id,due_date 
FROM dm_dbo.inbox_docs i, dm_document (ALL) d
WHERE
i.r_object_id = d.r_object_id 
AND i_latest_flag = 1 
AND DATEFLOOR(day, due_date)<=DATEFLOOR(day, DATE(NOW)) 
AND due_date IS NOT NULLDATE 
ORDER BY due_date,r_object_id