USP_DATAFORMTEMPLATE_VIEW_EDUCATIONDEMOGRAPHIC

The load procedure used by the view dataform template "Education Demographic View Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@CONSTITUENTTYPE tinyint INOUT Constituent type
@ETHNICITY nvarchar(100) INOUT Ethnicity
@RELIGION nvarchar(100) INOUT Religion
@INCOME nvarchar(100) INOUT Income
@BIRTHPLACE nvarchar(50) INOUT Birthplace

Definition

Copy


            create procedure dbo.USP_DATAFORMTEMPLATE_VIEW_EDUCATIONDEMOGRAPHIC
            (
            @ID uniqueidentifier,
            @DATALOADED bit = 0 output,        
            @CONSTITUENTTYPE tinyint = null output,
            @ETHNICITY nvarchar(100) = null output,
            @RELIGION nvarchar(100) = null output,
            @INCOME nvarchar(100) = null output,
            @BIRTHPLACE nvarchar(50) = null output
            )
            as
                set nocount on;

                set @DATALOADED = 0;

                select 
                    @DATALOADED = 1,
                    @CONSTITUENTTYPE = case 
                        when (C.ISORGANIZATION = 0) and (C.ISGROUP = 0) then 0    -- Individual

                        when (C.ISORGANIZATION = 1) then 1 end,                    -- Organization

                    @ETHNICITY = dbo.UFN_ETHNICITYCODE_GETDESCRIPTION(D.ETHNICITYCODEID),
                    @RELIGION = dbo.UFN_RELIGIONCODE_GETDESCRIPTION(D.RELIGIONCODEID),
                    @INCOME = dbo.UFN_INCOMECODE_GETDESCRIPTION(D.INCOMECODEID),
                    @BIRTHPLACE = D.BIRTHPLACE
                from dbo.CONSTITUENT C
                    left outer join dbo.DEMOGRAPHIC D with (nolock) on D.ID = C.ID
                where 
                    C.ID = @ID 

                return 0;