USP_DATAFORMTEMPLATE_VIEW_TEAMFUNDRAISERFROMCONSTITUENTANDAPPEAL

The load procedure used by the view dataform template "Team Fundraiser from Constituent and Appeal View Form"

Parameters

Parameter Parameter Type Mode Description
@ID nvarchar(72) 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.
@GOAL money INOUT Goal
@BASECURRENCYID uniqueidentifier INOUT Base currency

Definition

Copy


                CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_TEAMFUNDRAISERFROMCONSTITUENTANDAPPEAL
                (
                    @ID nvarchar(72),
                    @DATALOADED bit = 0 output,
                    @GOAL money = null output,
                    @BASECURRENCYID uniqueidentifier = null output
                )
                as
                begin
                    set nocount on;

                    set @DATALOADED = 0;

                    select
                        @DATALOADED = 1,
                        @GOAL = TEAMFUNDRAISER.GOAL,
                        @BASECURRENCYID = TEAMFUNDRAISER.BASECURRENCYID
                    from
                        dbo.TEAMFUNDRAISER
                    where
                        TEAMFUNDRAISER.CONSTITUENTID = left(@ID, 36)
                        and TEAMFUNDRAISER.APPEALID = right(@ID, 36);

                    --For constituents that are not team fundraisers this view returns the default goal

                    if @DATALOADED = 0
                        select
                            @DATALOADED = 1,
                            @GOAL = 0
                        from
                            dbo.CONSTITUENT
                        where
                            CONSTITUENT.ID = left(@ID, 36);

                    return 0;
                end