---
title: clsProviderSearch
summary: API reference for clsProviderSearch.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-24
library: SAIF.Business.View.Provider
reference_type: package
---

# clsProviderSearch

API reference for clsProviderSearch.

## Purpose
- Search orchestrator that dynamically composes a joined SQL query across `PROVIDER_LOCATION`, `PROVIDER_TYPE_CODE`, `PROVIDER_ADDRESS`, `PROVIDER_TAX_ID`, `PROVIDER_IDENTITY`, `PROVIDER_SERVICE`, and `MCO_PROVIDER` tables based on caller-supplied filters (service type, MCO plan, business/person flag, tax ID, name, address, phone).
- `searchForProvider()` adds `JOIN` clauses and bind variables only for filters actually supplied by the caller, and returns matches as a `ReadOnlyCollection(Of clsSearchResults)`.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Providers | `ReadOnly Property Providers() As clsProviders` | Returns the read-only collection of search results populated by the most recent `searchForProvider()` call. |
| SearchCriteria | `ReadOnly Property SearchCriteria() As clsSearchCriteria` | Returns the mutable `clsSearchCriteria` instance the caller sets filter values on before searching. |
| New(inDPI) | `Sub New(ByVal inDPI As IDataPortalInfo)` | Constructs the search object, initializing empty `Providers` and a new `SearchCriteria`. |
| resetSearchCriteria | `Sub resetSearchCriteria()` | Replaces `SearchCriteria` with a new, empty `clsSearchCriteria` instance. |
| searchForProvider | `Sub searchForProvider()` | Builds and executes a dynamic UNION query (base search plus a registered-name variant) against `PROVIDER_LOCATION`/`PROVIDER_TYPE_CODE`/`PROVIDER_ADDRESS`, adding filter predicates only for the `SearchCriteria` fields the caller populated, and repopulates `Providers` with the resulting `clsSearchResults` rows — this statement is documented as [SQL-015](../../sql/SQL-015-saif-business-view-provider.md). |

## Nested classes
| Type | Purpose |
| --- | --- |
| `clsSearchCriteria` | Mutable search-filter object (`ProviderName`, `TaxId`, `OtherId`, `ProviderType`, `ServiceType`, `MCOName`, `BusinessPerson`, `Street`, `City`, `State`, `ZipCode`, `AreaCode`, `PhoneNum`) with three business rules: `Rule_ValidCriteria` (at least one filter field must be populated), `Rule_ValidZipCode` (must be numeric if supplied), and `Rule_ValidTaxId` (fewer than 10 digits after removing hyphens). `BusinesPersonDescr` returns a display string ("Businesses Only" / "Persons Only" / "Businesses and Persons") derived from `BusinessPerson`. |
| `clsProviders` | `Inherits Collections.ObjectModel.ReadOnlyCollection(Of clsSearchResults)`; a read-only wrapper collection with an internal `Friend DPI` and a public `Add(inCase As clsSearchResults)` method used by `searchForProvider()` to populate results. |
| `clsSearchResults` | Result-row type exposing `ProvLocSeqNum`, `FullName`, `SortName`, `PhysAdddressLine1`, `PhysCity`, `PhysState`, `PhysZipCode`, `PhoneNumber`, `PrimaryLocationFlag`, `BusinessFlag`, `TypeDescr`, and `New(inDPI)`. |

## Behavioral notes
- `searchForProvider()` dynamically assembles two `UNION`-ed `SELECT` statements (one matching on the provider location's own name/business fields, one matching on the registered name from `PROVIDER_TAX_ID`) and appends `WHERE`/`JOIN` fragments only for the criteria fields that are non-empty on `SearchCriteria`, consistent with [BR-003](../../business-rules.md#br-003-provider-search-dynamic-join-filtering).
- `AddBusinessRules` on `clsProviderSearch` itself is an empty override (the search object carries no rules directly; all validation lives on the nested `clsSearchCriteria`).

## Constraints and usage notes
- `clsSearchCriteria` and `clsSearchResults` are constructed only through their `Friend`/public constructors from within this class's own methods; callers interact with them via the `SearchCriteria` and `Providers` properties.

## Inherited members (from clsBusinessBase)

This type inherits the following public surface from clsBusinessBase (`Legacy\BusinessObjectFramework\clsBusinessBase.vb`), in addition to the members listed above:

| Member | Signature | Purpose |
| --- | --- | --- |
| MyGuid | `ReadOnly Property MyGuid() As String` | Returns the internal GUID that uniquely identifies this in-memory object instance. |
| IsNew | `ReadOnly Property IsNew() As Boolean` | Indicates whether the object has not yet been persisted. |
| IsDeleted | `ReadOnly Property IsDeleted() As Boolean` | Indicates whether the object is marked for deletion. |
| IsDirty | `Overridable ReadOnly Property IsDirty() As Boolean` | Indicates whether the object (or a child) has unsaved changes. |
| IsValid | `Overridable ReadOnly Property IsValid() As Boolean` | Indicates whether the object currently has no broken validation rules. |
| ValidateOnDelete | `Property ValidateOnDelete As Boolean` | Controls whether validation rules run before a delete operation. |
| Rules | `ReadOnly Property Rules() As clsRulesManager` | Returns the rules manager that tracks broken rules for this object. |
| ErrorCount | `ReadOnly Property ErrorCount() As Integer` | Returns the number of broken error-severity rules. |
| ErrorMessages | `ReadOnly Property ErrorMessages() As String()` | Returns the text of all broken error-severity rules. |
| WarningCount | `ReadOnly Property WarningCount() As Integer` | Returns the number of broken warning-severity rules. |
| WarningMessages | `ReadOnly Property WarningMessages() As String()` | Returns the text of all broken warning-severity rules. |
| InformationalCount | `ReadOnly Property InformationalCount() As Integer` | Returns the number of broken informational-severity rules. |
| InformationalMessages | `ReadOnly Property InformationalMessages() As String()` | Returns the text of all broken informational-severity rules. |
| BeginEdit | `Sub BeginEdit()` | Begins an editable transaction, snapshotting current field values. |
| CancelEdit | `Sub CancelEdit()` | Rolls back field values to the last `BeginEdit` snapshot. |
| ApplyEdit | `Sub ApplyEdit()` | Commits the current edit transaction, discarding the rollback snapshot. |
| Delete | `Sub Delete()` | Marks the object for deletion on the next save. |
| Save | `Overridable Function Save() As Boolean` | Persists the object (insert, update, or delete) through the BOF data portal, if valid. |
| SaveChild | `Overridable Function SaveChild() As Boolean` | Persists the object as a child of a parent object/collection. |
| Clone | `Function Clone() As Object` | Returns a deep copy of the object. |
| XMLElementName | `Property XMLElementName() As String` | Gets or sets the XML element name used when serializing this object. |
| GetDataset | `Sub GetDataset(ByRef inDS As DataSet)` | Populates a `DataSet` with the object's field values. |
| GetDataset (named table) | `Sub GetDataset(ByRef inDS As DataSet, ByVal inTableName As String)` | Populates a `DataSet` table with the given name with the object's field values. |
| GetReportXML | `Function GetReportXML(ByVal inElementName As String) As String` | Returns an XML fragment representing the object using the supplied element name. |
| GetReportXML (default name) | `Function GetReportXML() As String` | Returns an XML fragment representing the object using the default XML element name. |
| ToXml | `Function ToXml() As String` | Serializes the object to XML using the default element name. |
| ToXml (named tag) | `Function ToXml(ByVal inTagName As String) As String` | Serializes the object to XML using the supplied tag name. |
| PreviousLinkItem / NextLinkItem | `ReadOnly Property PreviousLinkItem() As ILinkItem` / `ReadOnly Property NextLinkItem() As ILinkItem` | Returns the adjacent linked-list item for collection traversal. |
| SetValueOnChange | `Function SetValueOnChange(Of T)(ByRef inFieldValue As T, ByVal inSetValue As T, Optional ByVal inMarkDirty As Boolean = True) As Boolean` | Sets a backing field only when the value changes, optionally marking the object dirty. |

## Sources
- `Business\SAIF.Business.View.Provider\clsProviderSearch.vb`
