USP_DATAFORMTEMPLATE_VIEW_TRANSLATIONTABLE

The load procedure used by the view dataform template "Translation table profile view"

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.
@NAME nvarchar(60) INOUT Name
@VALIDGRADES nvarchar(40) INOUT Numeric grade range
@GRADESAREDEFINED bit INOUT GRADESAREDEFINED
@GAPSEXISTLOW bit INOUT The lowest score does not match the highest number in the numeric grade range.
@GAPSEXISTHIGH bit INOUT The highest score does not match the highest number in the numeric grade range.

Definition

Copy


CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_TRANSLATIONTABLE
(
    @ID uniqueidentifier,
    @DATALOADED bit = 0 output,
    @NAME nvarchar(60) = null output,
    @VALIDGRADES nvarchar(40) = null output,
    @GRADESAREDEFINED bit = null output,
    @GAPSEXISTLOW bit = null output,
    @GAPSEXISTHIGH bit = null output
)
as
    set nocount on;

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

    set @DATALOADED = 0;
    set @GRADESAREDEFINED = 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.

    select @DATALOADED = 1,
           @NAME = NAME,
           @VALIDGRADES = cast(LOWESTSCOREALLOWED as varchar(18)) + ' - ' + cast(HIGHESTSCOREALLOWED as varchar(18)),
           @GRADESAREDEFINED = case when exists (select * from TRANSLATIONTABLEGRADE where TRANSLATIONTABLEGRADE.TRANSLATIONTABLEID = TRANSLATIONTABLE.ID) then 1 else 0 end,
           @GAPSEXISTLOW = case dbo.UFN_TRANSLATIONTABLE_GAPEXISTS(TRANSLATIONTABLE.ID) when 0 then 0 when 2 then 0 else 1 end,
           @GAPSEXISTHIGH = case when dbo.UFN_TRANSLATIONTABLE_GAPEXISTS(TRANSLATIONTABLE.ID) < 2 then 0 else 1 end
    from dbo.TRANSLATIONTABLE
    WHERE ID = @ID

    return 0;