USP_DATALIST_EVENTREGISTRANTS

Displays the registrants for the given event.

Parameters

Parameter Parameter Type Mode Description
@EVENTID uniqueidentifier IN Input parameter indicating the context ID for the data list.
@ATTENDED bit IN Attended
@WILLNOTATTEND bit IN Will not attend
@ISCANCELLED bit IN Canceled

Definition

Copy


                CREATE procedure dbo.USP_DATALIST_EVENTREGISTRANTS
                (
                    @EVENTID uniqueidentifier,
                    @ATTENDED bit = null,
                    @WILLNOTATTEND bit = null,
                    @ISCANCELLED bit = null
                )
                as
                    set nocount on;

                    select 
                        REGISTRANT.ID,
                        dbo.UFN_REGISTRANT_GETNAME(REGISTRANT.ID),                        
                        coalesce((select count(GUESTS.ID) from dbo.REGISTRANT as GUESTS where GUESTS.GUESTOFREGISTRANTID = REGISTRANT.ID),0),
                        REGISTRANT.ATTENDED,
                        dbo.UFN_REGISTRANT_GETHOSTNAME(ID, GUESTOFREGISTRANTID),
                        case
                            when REGISTRANT.WILLNOTATTEND = 1 then 'Will not attend'
                            else ''
                        end,
                        REGISTRANT.WILLNOTATTEND,
                        case
                            when dbo.UFN_REGISTRANT_ISCANCELLED(REGISTRANT.ID) = 1 then 'Canceled'
                            else ''
                        end,
                        case when REGISTRANT.CONSTITUENTID is not null then 0 else 1 end as ISUNKNOWNGUEST,
                        case
                            when REGISTRANT.ONLINEREGISTRANT = 1 then 'Yes'
                            else ''
                        end,
                        REGISTRANT.ONLINEREGISTRANT,
                        dbo.UFN_EVENTREGISTRANT_GETBALANCE(REGISTRANT.ID) as BALANCE,
                        case when REGISTRANT.GUESTOFREGISTRANTID is not null then 1 else 0 end as ISGUEST,
                        DATEADDED,
                        dbo.UFN_CHANGEAGENT_GETUSERNAME(REGISTRANT.ADDEDBYID) as ADDEDBY
                    from 
                        dbo.REGISTRANT                         
                    where 
                        EVENTID = @EVENTID and 
                        (
                            (@ATTENDED is null
                                or 
                            (ATTENDED = @ATTENDED)
                        )
                        and
                        (
                            (@WILLNOTATTEND is null)
                                or
                            (WILLNOTATTEND = @WILLNOTATTEND)
                        )
                        and
                        (
                            (@ISCANCELLED is null)
                                or
                            (WILLNOTATTEND = @ISCANCELLED)
                        )
                    order by
                        REGISTRANT.DATEADDED;