UFN_COURSEGRADINGMARKINGCOLUMN_VALIDVALUESALLOWED

Returns a number representing valid values allowed selection based on existing grades: 0 - both, 1 - grades, 2 - numeric, 3 - neither.

Return

Return Type
tinyint

Parameters

Parameter Parameter Type Mode Description
@COURSEGRADINGMARKINGCOLUMNID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_COURSEGRADINGMARKINGCOLUMN_VALIDVALUESALLOWED
(
    @COURSEGRADINGMARKINGCOLUMNID uniqueidentifier
)
returns tinyint
as begin
     -- all three selections are valid

    declare @retval tinyint = 0;

     -- only selection of "Both" or "Grade" is valid

    if exists (select * from dbo.STUDENTMARKINGCOLUMNGRADE 
                where GRADETYPECODE = 1 and GRADEISBLANK = 0 and @COURSEGRADINGMARKINGCOLUMNID = COURSEGRADINGMARKINGCOLUMNID)
        set @retval = 1;

     -- only selection of "Both" or "Numeric" is valid; or only "Both" is valid

    if exists (select * from dbo.STUDENTMARKINGCOLUMNGRADE 
                where GRADETYPECODE = 2 and GRADEISBLANK = 0 and @COURSEGRADINGMARKINGCOLUMNID = COURSEGRADINGMARKINGCOLUMNID)
        set @retval = @retval + 2;

    return @retval
end