USP_DATAFORMTEMPLATE_EDITLOAD_COMMUNICATIONLETTERACTIVITYEXCLUSIONS

The load procedure used by the edit dataform template "Communication Exclusions 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.
@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.
@EXCLUDEBASEDONRECENTCOMMUNICATION bit INOUT Exclude constituents included in communications within the past:
@NUMRECENTCOMMUNICATIONPERIODS int INOUT Number of recent communication periods
@RECENTCOMMUNICATIONPERIODTYPECODE tinyint INOUT
@EXCLUDEBASEDONTOTALCOMMUNICATIONSINPASTYEAR bit INOUT Exclude constituents included in at least the following number of communications in the past year:
@NUMTOTALCOMMUNICATIONSINPASTYEAR int INOUT Number of communications
@EXCLUDEBASEDONRECENTGIVING bit INOUT Exclude constituents with revenue in the past:
@NUMRECENTGIVINGPERIODS int INOUT Number of recent revenue periods
@RECENTGIVINGPERIODTYPECODE tinyint INOUT
@EXCLUDEBASEDONTOTALGIVINGINPASTYEAR bit INOUT Exclude constituents with at least the following total revenue amount in the past year:
@TOTALREVENUEAMOUNTINPASTYEAR money INOUT Total revenue amount
@COMMUNICATIONTYPES xml INOUT Communication types

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_COMMUNICATIONLETTERACTIVITYEXCLUSIONS
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @TSLONG bigint = 0 output,    
    @EXCLUDEBASEDONRECENTCOMMUNICATION bit = null output,
    @NUMRECENTCOMMUNICATIONPERIODS int = null output,
    @RECENTCOMMUNICATIONPERIODTYPECODE tinyint = null output,
    @EXCLUDEBASEDONTOTALCOMMUNICATIONSINPASTYEAR bit = null output,
    @NUMTOTALCOMMUNICATIONSINPASTYEAR int = null output,
    @EXCLUDEBASEDONRECENTGIVING bit = null output,
    @NUMRECENTGIVINGPERIODS int = null output,
    @RECENTGIVINGPERIODTYPECODE tinyint = null output,
    @EXCLUDEBASEDONTOTALGIVINGINPASTYEAR bit = null output,
    @TOTALREVENUEAMOUNTINPASTYEAR money = null output,
    @COMMUNICATIONTYPES xml = null output
)
as
    set nocount on;

    -- be sure to set these, in case the select returns no rows
    set @DATALOADED = 0
    set @TSLONG = 0

    select 
        @DATALOADED = 1,
        @EXCLUDEBASEDONRECENTCOMMUNICATION = EXCLUDEBASEDONRECENTCOMMUNICATION,
        @NUMRECENTCOMMUNICATIONPERIODS = NUMRECENTCOMMUNICATIONPERIODS,
        @RECENTCOMMUNICATIONPERIODTYPECODE = RECENTCOMMUNICATIONPERIODTYPECODE,
        @EXCLUDEBASEDONTOTALCOMMUNICATIONSINPASTYEAR = EXCLUDEBASEDONTOTALCOMMUNICATIONSINPASTYEAR,
        @NUMTOTALCOMMUNICATIONSINPASTYEAR = NUMTOTALCOMMUNICATIONSINPASTYEAR,
        @EXCLUDEBASEDONRECENTGIVING = EXCLUDEBASEDONRECENTGIVING,
        @NUMRECENTGIVINGPERIODS = NUMRECENTGIVINGPERIODS,
        @RECENTGIVINGPERIODTYPECODE = RECENTGIVINGPERIODTYPECODE,
        @EXCLUDEBASEDONTOTALGIVINGINPASTYEAR = EXCLUDEBASEDONTOTALGIVINGINPASTYEAR,
        @TOTALREVENUEAMOUNTINPASTYEAR = TOTALREVENUEAMOUNTINPASTYEAR,
        @COMMUNICATIONTYPES = dbo.UFN_COMMUNICATIONLETTERACTIVITYEXCLUSION_GETCOMMUNICATIONTYPES_TOITEMLISTXML(ID),
        @TSLONG = TSLONG
    from dbo.COMMUNICATIONLETTERACTIVITYEXCLUSIONS
    where ID = @ID;

    return 0;