USP_DATAFORMTEMPLATE_EDIT_BATCHCOMMITPARAMETERS3
The save procedure used by the edit dataform template "Batch Commit Process Parameter Edit Form 3".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@CREATEOUTPUTIDSET | bit | IN | Create output Selection |
@OUTPUTIDSETNAME | nvarchar(100) | IN | Selection name |
@OVERWRITEOUTPUTIDSET | bit | IN | Overwrite existing Selection |
@CREATEEXCEPTIONBATCH | bit | IN | Create exception batch |
@EXCEPTIONBATCHNAME | nvarchar(60) | IN | Exception batch name |
@PURGEBATCH | bit | IN | Delete batch after committing |
@VALIDATEBATCH | bit | IN | Validate batch before committing |
@CHECKFORDUPLICATERECORDS | bit | IN | Check for duplicate constituents |
@CREATECONTROLREPORT | bit | IN | Create control report |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_BATCHCOMMITPARAMETERS3
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@CREATEOUTPUTIDSET bit,
@OUTPUTIDSETNAME nvarchar(100),
@OVERWRITEOUTPUTIDSET bit,
@CREATEEXCEPTIONBATCH bit,
@EXCEPTIONBATCHNAME nvarchar(60),
@PURGEBATCH bit,
@VALIDATEBATCH bit,
@CHECKFORDUPLICATERECORDS bit,
@CREATECONTROLREPORT bit
)
as
set NOCOUNT on;
declare @valid bit;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
begin try
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if @CREATEOUTPUTIDSET = 1
begin
select @valid = dbo.UFN_BUSINESSPROCESS_IDSETCANBECREATED(@OUTPUTIDSETNAME);
if @valid = 0
raiserror('A Selection with the same name already exists and is associated with a query and cannot be overwritten. Please select a different Selection name.',13,1);
if @OVERWRITEOUTPUTIDSET = 0 or @OVERWRITEOUTPUTIDSET is null
begin
select @valid=dbo.UFN_BUSINESSPROCESS_IDSETEXISTS(@OUTPUTIDSETNAME);
if @valid = 1
raiserror('A Selection with the same name already exists. Please select a different name or select to overwrite the existing Selection.',13,1);
end
end
if @CREATEEXCEPTIONBATCH = 1
begin
declare @exceptionbatchid uniqueidentifier;
select @exceptionbatchid=dbo.UFN_BATCH_GETID(@EXCEPTIONBATCHNAME);
if not @exceptionbatchid is null
raiserror('The exception batch number specified is already in use.',13,1);
end
update
dbo.[BATCH]
set
[CREATEOUTPUTIDSET] = @CREATEOUTPUTIDSET,
[OUTPUTIDSETNAME] = @OUTPUTIDSETNAME,
[OVERWRITEOUTPUTIDSET] = @OVERWRITEOUTPUTIDSET,
[CREATEEXCEPTIONBATCH] = @CREATEEXCEPTIONBATCH,
[EXCEPTIONBATCHNAME] = @EXCEPTIONBATCHNAME,
[PURGEBATCH] = @PURGEBATCH,
[CREATECONTROLREPORT] = @CREATECONTROLREPORT,
[VALIDATEBATCH] = @VALIDATEBATCH,
[CHECKFORDUPLICATERECORDS] = @CHECKFORDUPLICATERECORDS,
[CHANGEDBYID] = @CHANGEAGENTID
where
[ID] = @ID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;