﻿---
title: clsEmployeeDataCollection
summary: API reference for clsEmployeeDataCollection.
status: draft
owner: SAIF
last_reviewed: 2026-07-24
library: SAIF.Business
reference_type: package
---

# clsEmployeeDataCollection

`clsEmployeeDataCollection` is a public class in `SAIF.Business` that inherits `clsBusinessCollectionBase` and retrieves typed `clsEmployeeData` records using several employee-query modes.

## Purpose
- Holds `clsEmployeeData` items with typed indexers by collection position and employee ID.
- Retrieves employee lists by department, job title, location, active status, or all employees.
- Optionally unions virtual-employee rows into the all-employees query path.
- Provides convenience filters for active employees and arbitrary predicates.

## Context
- Namespace: `SAIF.Business`
- Assembly/package: `SAIF.Business`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `QueryType` | `Public Enum QueryType` | Defines the supported retrieval modes: `Department`, `JobTitle`, `Location`, `Active`, and `All`. |
| `Item` | `Default Public ReadOnly Property Item(ByVal Index As Integer) As clsEmployeeData` | Returns the employee at the specified collection index. |
| `Item` | `Default Public ReadOnly Property Item(ByVal inEmplid As String) As clsEmployeeData` | Returns the first employee whose `ID` matches the supplied employee ID, or `Nothing` when no match exists. |
| `MyCriteria` | `Public ReadOnly Property MyCriteria() As Criteria` | Exposes the current criteria object used to build the retrieval SQL. |
| `IsValid` | `Public Overrides ReadOnly Property IsValid() As Boolean` | Returns the base collection validity state. |
| `IsSavable` | `Public ReadOnly Property IsSavable() As Boolean` | Returns whether the collection considers itself savable; this implementation always returns `True`. |
| `Add` | `Public Shadows Function Add(ByVal inclsEmployeeData As clsEmployeeData) As Integer` | Adds a `clsEmployeeData` item to the collection through the base collection implementation. |
| `Contains` | `Public Overloads Function Contains(ByVal inclsEmployeeData As clsEmployeeData) As Boolean` | Returns whether an equal employee object exists in the active list. |
| `Contains` | `Public Overloads Function Contains(ByVal inEmplid As String) As Boolean` | Returns whether an employee matching the supplied employee ID exists in the active list. |
| `ContainsDeleted` | `Public Overloads Function ContainsDeleted(ByVal inclsEmployeeData As clsEmployeeData) As Boolean` | Returns whether an equal employee object exists in the deleted-items list. |
| `ContainsDeleted` | `Public Overloads Function ContainsDeleted(ByVal inEmplid As String) As Boolean` | Returns whether an employee ID exists in the deleted-items list. |
| `Remove` | `Public Sub Remove(ByVal inclsEmployeeData As clsEmployeeData)` | Removes the supplied employee object from the active list. |
| `Remove` | `Public Sub Remove(ByVal inEmplid As String)` | Removes the first employee whose `ID` matches the supplied employee ID. |
| `GetEmployeeDataCollectionByDepartmentID` | `Public Shared Function GetEmployeeDataCollectionByDepartmentID(ByVal inDataportal As IDataPortalInfo, ByVal inDepartmentID As String) As clsEmployeeDataCollection` | Retrieves employees for a specific department ID. |
| `GetEmployeeDataCollectionByJobTitle` | `Public Shared Function GetEmployeeDataCollectionByJobTitle(ByVal inDataportal As IDataPortalInfo, ByVal inJobTitle As String) As clsEmployeeDataCollection` | Retrieves employees for a specific job title. |
| `GetEmployeeDataCollectionByLocation` | `Public Shared Function GetEmployeeDataCollectionByLocation(ByVal inDataportal As IDataPortalInfo, ByVal inLocation As String) As clsEmployeeDataCollection` | Retrieves employees for a specific location. |
| `GetAllActiveEmployees` | `Public Shared Function GetAllActiveEmployees(ByVal inDataportal As IDataPortalInfo) As clsEmployeeDataCollection` | Retrieves only employees whose status is active. |
| `GetAllEmployees` | `Public Shared Function GetAllEmployees(ByVal inDataportal As IDataPortalInfo) As clsEmployeeDataCollection` | Retrieves all employees without virtual rows. |
| `GetAllEmployees` | `Public Shared Function GetAllEmployees(ByVal inDataportal As IDataPortalInfo, ByVal includeVirtual As Boolean) As clsEmployeeDataCollection` | Retrieves all employees and optionally unions virtual employees into the result set. |
| `FilterBy_ActiveOnly` | `Public Function FilterBy_ActiveOnly() As clsEmployeeDataCollection` | Returns a filtered collection containing only employees whose `IsActive` property is true. |
| `Where` | `Public Function Where(ByVal match As Predicate(Of clsEmployeeData)) As clsEmployeeDataCollection` | Returns a filtered collection produced by the supplied predicate. |

## Behavioral notes
- `BeforeRetrieve` assigns `MyCriteria.RetrieveSQL` directly to the data request used by the collection.
- `AfterRetrieve` creates a new `clsEmployeeData` for each returned row, calls `Load`, and adds it to the collection.
- `IsValid` delegates to `MyBase.IsValid`; this class does not add additional child-validation checks in its implementation.
- `IsSavable` always returns `True` because its commented-out child checks are not active.
- `Criteria.RetrieveSQL` concatenates department, job-title, and location values into the SQL text and appends `ADP.EMPL_STATUS = 'A'` for the active query mode.
- When `includeVirtual` is true, `Criteria.RetrieveSQL` appends `UNION ALL` plus `clsEmployeeData.Criteria.Retrieve_Virtual_SQL` and applies the same query-type filters to the virtual branch.

## Constraints and usage notes
- The constructor is `Protected`; callers obtain populated instances through the shared retrieval methods.
- `Remove(ByVal inEmplid As String)` removes only the first matching employee ID it finds.
- `GetAllEmployees(ByVal includeVirtual As Boolean)` is the only public entry point that can include virtual employees.
- This page documents only members declared on `clsEmployeeDataCollection`; inherited collection operations come from `clsBusinessCollectionBase`.

## Sources
- `Business\SAIF.Business\clsEmployeeDataCollection.vb`
