Operation Details
Description: Retrieves all of the activities related to the concern role 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 concernRoleID = :concernRoleID 
  AND startDateTime <= :endDateTime 
  AND endDateTime >= :startDateTime 
  AND 
  (
    
    (
      :activityTypeCode IS NULL 
    ) 
    OR 
    (
      activityTypeCode = :activityTypeCode 
    ) 
  ) 
  AND recordStatusCode = :recordStatusCode