Database SQL Operation: WorkQueue.searchWorkQueueReservedUserJobTasks
Description: | Returns a count of all of the tasks reserved by the specified users for all of the jobs that the user is subscribed to. |
Sterotype: | nsmulti |
SELECT
ta.relatedID,
count(*)
INTO
:workQueueID,
:numberOfRecords
FROM
TaskAssignment ta
WHERE ta.assigneeType = :assigneeType
AND ta.relatedID IN
(
SELECT
wq.workQueueID
FROM
WorkQueue wq
WHERE wq.workQueueID IN
(
SELECT
workQueueID
FROM
WorkQueueSubscription wqs
WHERE wqs.subscriberType = :subscriberType
AND wqs.subscriberID IN
(
SELECT
DISTINCT j.jobID
FROM
Users u,
PositionHolderLink ph,
Position p,
Job j
WHERE u.userName = :userName
AND u.userName = ph.userName
AND ph.positionID = p.positionID
AND j.jobID =p.jobID
AND ph.recordStatus = :recordStatus
AND :currentDate >= ph.fromDate
AND
(
:currentDate <= ph.toDate
OR ph.toDate IS NULL
)
)
)
)
AND ta.taskID IN
(
SELECT
taskID
FROM
Task t
WHERE t.reservedBy = :userName
AND t.taskID = ta.taskID
)
GROUP
BY ta.relatedID
|