Operation Details
Description: Counts the number of unreserved tasks for the specified object. See {@link searchUnreservedTasksByRelatedIDType} for the equivalent search method.
Sterotype: ns
SQL
SELECT
  COUNT (*)
INTO
  :numberOfRecords 
FROM
  TaskAssignment ta,
  Task t 
  
  LEFT OUTER JOIN
  
  WorkflowDeadline wfdl 
  ON wfdl.taskID = t.taskID 
WHERE 
  (
    :searchByRelatedIDInd = '0' 
    OR ta.relatedID = :relatedID 
  ) 
  AND 
  (
    :relatedName IS NULL 
    OR ta.relatedName = :relatedName 
  ) 
  AND ta.assigneeType = :assigneeType 
  AND t.status NOT IN ( :closedStatus, :completedStatus) 
  AND t.taskID =ta.taskID 
  AND t.reservedBy IS NULL