This entity includes a plug-in that checks for duplicate vehicle models. This plug in uses the spCheckForVehicleModelMatch Database Object to provide the following matching logic:

This stored procedure receives the RecordID, Year, and ModelName from the CheckForDuplicate method (using the values from the current GE object) to check and returns a Match Type and if a match is found, a list of matching IDs. This stored procedure returns one of the following Match Values:

The text of the spCheckForVehicleModelMatch stored procedure appears below but you can also find it in the Database Objects service if you installed the sample application.

CREATE PROC
spCheckForVehicleModelMatch 
                               (@SourceID INT,
                                @Year INT,
                                @Name NVARCHAR(255),
                                @ManufacturerID INT)
AS
SELECT MatchType, ID FROM 
(SELECT MatchType 
= CASE
                WHEN 
                                (Year = @Year AND
                                 Name = @Name AND
                                 ManufacturerID = @ManufacturerID AND
                                 ID <> @SourceID)
                THEN
                                1
                WHEN
                                (Name = @Name AND
                                 ManufacturerID = @ManufacturerID AND
                                 ID <> @SourceID)
                THEN
                                2
                END,

ID FROM APTIFY..vwVehicleModels) VehicleModelMatch
WHERE MatchType IS NOT NULL 

Related topics