USP_DATAFORMTEMPLATE_VIEW_SURVEY

The load procedure used by the view dataform template "Survey View Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@NAME nvarchar(400) INOUT Name
@DATESENT datetime INOUT Send date
@DATERESPONDED datetime INOUT Response date
@CATEGORY nvarchar(250) INOUT Category
@COMMENT nvarchar(max) INOUT Comment
@NUMBEROFQUESTIONS int INOUT Number of questions

Definition

Copy


                CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_SURVEY
                (
                    @ID uniqueidentifier,
                    @CURRENTAPPUSERID uniqueidentifier,
                    @DATALOADED bit = 0 output,
                    @NAME nvarchar(400) = null output,
                    @DATESENT datetime = null output,
                    @DATERESPONDED datetime = null output,
                    @CATEGORY nvarchar(250) = null output,
                    @COMMENT nvarchar(max) = null output,
                    @NUMBEROFQUESTIONS int = null output
                )
                as
                    set nocount on;

                    set @DATALOADED = 0;

                    select
                        @DATALOADED = 1,
                        @NAME = SURVEY.NAME,
                        @DATESENT = SURVEY.DATESENT,
                        @DATERESPONDED = SURVEY.DATERESPONDED,
                        @COMMENT = SURVEY.COMMENT,
                        @CATEGORY = dbo.UFN_SURVEYCATEGORYCODE_GETDESCRIPTION(SURVEY.SURVEYCATEGORYCODEID),
                        @NUMBEROFQUESTIONS = (select count(ID) from dbo.SURVEYRESPONSE where SURVEYRESPONSE.SURVEYID = SURVEY.ID)                        
                    from
                        dbo.SURVEY
                    where
                        SURVEY.ID = @ID;

                    return 0;