USP_DATAFORMTEMPLATE_VIEW_STUDENTCONSTITUENCYCRITERIA

The load procedure used by the view dataform template "Student Constituency Criteria View Data Form"

Parameters

Parameter Parameter Type Mode Description
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@ISCONSTITUENTWHEN nvarchar(50) INOUT Student is considered a constituent

Definition

Copy


                CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_STUDENTCONSTITUENCYCRITERIA
                (
                    @DATALOADED bit = 0 output,
                    @ISCONSTITUENTWHEN nvarchar(50) = null output
                )
                as
                    set nocount on;

                    -- be sure to set this, in case the select returns no rows

                    set @DATALOADED = 0;

                    -- populate the output parameters, which correspond to fields on the form.  Note that

                    -- we set @DATALOADED = 1 to indicate that the load was successful.  Otherwise, the system

                    -- will display a "no data loaded" message.

                    if (not exists (select ID from dbo.STUDENTCONSTITUENCYSETTINGS))
                    begin
                        set @DATALOADED = 1;
                        set @ISCONSTITUENTWHEN = 0;
                    end
                    else
                    begin
                        select @DATALOADED = 1,
                               @ISCONSTITUENTWHEN = ISCONSTITUENTWHEN
                        from dbo.STUDENTCONSTITUENCYSETTINGS;
                    end

                    return 0;