Operation Details
Description: Retrieves all of the activities that the concern role is invited to attend, for the specified date range with record status code specified.
Sterotype: nsmulti
SQL
SELECT
  activityID,
  userName,
  organisationID,
  subject,
  activityTypeCode,
  startDateTime,
  endDateTime,
  allDayInd,
  locationID,
  locationName,
  priorityCode,
  timeStatusCode,
  notes,
  recurrenceID,
  caseID,
  concernRoleID,
  recordStatusCode
INTO
  :activityID,
  :userName,
  :organisationID,
  :subject,
  :activityTypeCode,
  :startDateTime,
  :endDateTime,
  :allDayInd,
  :locationID,
  :locationName,
  :priorityCode,
  :timeStatusCode,
  :notes,
  :recurrenceID,
  :caseID,
  :concernRoleID,
  :recordStatusCode 
FROM
  Activity 
WHERE 
  (
    activityID in 
    ( 
    SELECT
      activityID 
    FROM
      ActivityAttendee 
    WHERE concernRoleID = :concernRoleID 
      AND recordStatusCode = :recordStatusCode 
      AND 
      (
        
        (
          :acceptedInd IS NULL 
        ) 
        OR 
        (
          acceptedInd = :acceptedInd 
        ) 
      ) 
    ) 
  ) 
  AND startDateTime <= :endDateTime 
  AND endDateTime >= :startDateTime 
  AND 
  (
    
    (
      :activityTypeCode IS NULL 
    ) 
    OR 
    (
      activityTypeCode = :activityTypeCode 
    ) 
  ) 
  AND recordStatusCode = :recordStatusCode