UFN_CONSTITUENTMATCH_KEYNAMESCOREDEDUCTION_BYRESULT

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@KEYNAMERESULT tinyint IN
@ISORGANIZATION bit IN

Definition

Copy


            create function dbo.UFN_CONSTITUENTMATCH_KEYNAMESCOREDEDUCTION_BYRESULT (
                @KEYNAMERESULT tinyint,
                @ISORGANIZATION bit
            )
            returns table -- Writing as in-line table for performance vs scalar function

            with schemabinding
            as return
                -- cannot match a constituent if keyname is not specified

                -- individuals: non-match last names are not as heavily weighted because of maiden names

                -- organizations: weight keyname same as first name since there is no first name, i.e., non-match should disqualify

                select
                    case @KEYNAMERESULT 
                        when 0 then 0 
                        when 1 then 3 
                        when 2 then 
                            case 
                                when @ISORGANIZATION = 0 then 8 
                                else 15 
                            end 
                        when 3 then 
                            case
                                when @ISORGANIZATION = 0 then 15 
                                else 31 
                            end 
                        else 100 
                    end as DEDUCTION