USP_DATAFORMTEMPLATE_EDITLOAD_DEMOGRAPHIC
The load procedure used by the edit dataform template "Demographic Edit 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 |
@ETHNICITYCODEID | uniqueidentifier | INOUT | Ethnicity |
@RELIGIONCODEID | uniqueidentifier | INOUT | Religion |
@TARGETCODEID | uniqueidentifier | INOUT | Target |
@INCOMECODEID | uniqueidentifier | INOUT | Income |
@BIRTHPLACE | nvarchar(50) | INOUT | Birthplace |
@DEMOGRAPHICETHNICITIES | xml | INOUT | Ethnicities |
@TSLONG | bigint | INOUT | Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record. |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_DEMOGRAPHIC(
@ID uniqueidentifier,
@DATALOADED bit = 0 output,
@CONSTITUENTTYPE tinyint = null output,
@ETHNICITYCODEID uniqueidentifier = null output,
@RELIGIONCODEID uniqueidentifier = null output,
@TARGETCODEID uniqueidentifier = null output,
@INCOMECODEID uniqueidentifier = null output,
@BIRTHPLACE nvarchar(50) = null output,
@DEMOGRAPHICETHNICITIES xml = null output,
@TSLONG bigint = 0 output
) as
set nocount on;
set @DATALOADED = 0;
set @TSLONG = 0;
select
@DATALOADED = 1,
@ID = C.ID,
@CONSTITUENTTYPE = case
when (C.ISORGANIZATION = 0) and (C.ISGROUP = 0) then 0 -- Individual
when (C.ISORGANIZATION = 1) then 1 -- Organization
when (GD.GROUPTYPECODE = 0) then 2 -- Household
else 3 end, -- Group
@ETHNICITYCODEID = D.ETHNICITYCODEID,
@RELIGIONCODEID = D.RELIGIONCODEID,
@TARGETCODEID = D.TARGETCODEID,
@INCOMECODEID = D.INCOMECODEID,
@BIRTHPLACE = D.BIRTHPLACE,
@DEMOGRAPHICETHNICITIES = dbo.UFN_CONSTITUENT_GETETHNICITIES_TOITEMLISTXML(@ID),
@TSLONG = D.TSLONG
from dbo.CONSTITUENT C
left outer join dbo.DEMOGRAPHIC D with (nolock) on D.ID = C.ID
left outer join dbo.GROUPDATA GD with (nolock) on GD.ID = C.ID
where
C.ID = @ID
return 0;