USP_DATAFORMTEMPLATE_ADD_BATCHMODELINGANDPROPENSITY
The save procedure used by the add dataform template "Modeling and Propensity Batch Row Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@BATCHID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@SEQUENCE | int | IN | Sequence |
@IMPORTID | nvarchar(36) | IN | Constituent |
@ANNUALGIFTLIKELIHOOD | smallint | IN | Annual giving likelihood |
@ANNUITYLIKELIHOOD | smallint | IN | Annuity likelihood |
@BEQUESTLIKELIHOOD | smallint | IN | Bequest likelihood |
@CRTLIKELIHOOD | smallint | IN | CRT likelihood |
@MAJORGIVINGLIKELIHOOD | smallint | IN | Major giving likelihood |
@PLANNEDGIFTLIKELIHOOD | smallint | IN | Planned giving likelihood |
@PATIENTRESPONSELIKELIHOOD | smallint | IN | Patient response likelihood |
@WPSCREENINGINDICATOR | nvarchar(1) | IN | WealthPoint screening indicator |
@ANALYTICSPROJECTID | uniqueidentifier | IN |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_BATCHMODELINGANDPROPENSITY (
@ID uniqueidentifier = null output,
@BATCHID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@SEQUENCE int,
@IMPORTID nvarchar(36),
@ANNUALGIFTLIKELIHOOD smallint = -1,
@ANNUITYLIKELIHOOD smallint = -1,
@BEQUESTLIKELIHOOD smallint = -1,
@CRTLIKELIHOOD smallint = -1,
@MAJORGIVINGLIKELIHOOD smallint = -1,
@PLANNEDGIFTLIKELIHOOD smallint = -1,
@PATIENTRESPONSELIKELIHOOD smallint = -1,
@WPSCREENINGINDICATOR nvarchar(1) = '',
@ANALYTICSPROJECTID uniqueidentifier = null
) as
set nocount on;
if @ID is null
set @ID = newid();
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
if not exists (select ID from dbo.CONSTITUENT where ID = @IMPORTID)
raiserror('BBERR_CONSTITUENTDOESNOTEXIST',13,1)
insert into dbo.BATCHMODELINGANDPROPENSITY(
ID,
BATCHID,
SEQUENCE,
CONSTITUENTID,
ANNUALGIFTLIKELIHOOD,
ANNUITYLIKELIHOOD,
BEQUESTLIKELIHOOD,
CRTLIKELIHOOD,
MAJORGIVINGLIKELIHOOD,
PLANNEDGIFTLIKELIHOOD,
PATIENTRESPONSELIKELIHOOD,
WPSCREENINGINDICATOR,
ANALYTICSPROJECTID,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
) values (
@ID,
@BATCHID,
@SEQUENCE,
cast(@IMPORTID as uniqueidentifier),
@ANNUALGIFTLIKELIHOOD,
@ANNUITYLIKELIHOOD,
@BEQUESTLIKELIHOOD,
@CRTLIKELIHOOD,
@MAJORGIVINGLIKELIHOOD,
@PLANNEDGIFTLIKELIHOOD,
@PATIENTRESPONSELIKELIHOOD,
@WPSCREENINGINDICATOR,
@ANALYTICSPROJECTID,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
);
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;