Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

  • Existing records that match a new record's Year, Model Name, and Manufacturer are flagged as absolute matches.
  • Existing records that match a new record's Model Name and Manufacturer (but not year) are flagged as potential duplicates.

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:

  • 0: No duplicates found
  • 1: Absolute Match Found, the record ID(s) of the absolute match will be placed in the arDuplicates array
  • 2: Possible Match(s) found, the record ID(s) of the potential match(s) will be placed in the arDuplicates array

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.

Code Block
languagesql
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 
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

Filter by label (Content by label)
showLabelsfalse
sorttitle
showSpacefalse
labelsduplicate-records