学生の年 ( stuyear
) を参照する以下のケース ステートメントをセットアップしました (最終的には asp.net コントロールによってトリガーされます。ケースは、結果を 3 つの列に出力するときに計算にこれを含めるようにセットアップされています。ただし、出力列が 0 を返すように、stuyear
範囲内の値をmaindata
11 から 10 に変更すると、ステートメントは最初の 3 つのケースでのみ有効であるように見え、最後の 6 つのケースでは、それらが無視されているかのように 0 を返します。
私がしたいことは、が、、stuyear
の内容を変更したときです。belowexpected
asexpected
aboveexpected
9 年、10 年、11 年に別々の列を設定して、回避できる場合は VB.net でそれらの可視性をトリガーしたくありません。
/*Progress*/
以下のコメントの下の例で、私が参照している特定のコードを見つけることができます。
;with MainData as
(
select surname, forename, stuyear, ks2en, result, case when ks2en='' then 5 else left(ks2en,1) end as ks2enlevel, value as ResultLevel, case when ks2en='' then 0 else 1 end as gotks2enlevel
from student join subject on student.upn=subject.upn join gradelookup on subject.result=gradelookup.grade where datacollection='March 2013' and stuyear=10 and name = 'English'
),
calcproglevel as
(
Select surname, forename, stuyear, ks2en, result, ks2enlevel, ResultLevel, gotks2enlevel, ResultLevel-ks2enlevel as levelsofprogress from MainData
),
calcprogtotals as
(
select surname, forename, stuyear, ks2en, result, ks2enlevel, ResultLevel, gotks2enlevel, levelsofprogress,
case when ks2enlevel >=4 then 1 else 0 end as AStarCTar,
case when resultlevel >=7 then 1 else 0 end as AStarC
From calcproglevel
)
select surname, forename, stuyear, ks2en, result, ks2enlevel, ResultLevel, gotks2enlevel, AStarCTar, AStarC, levelsofprogress,
/*Progress*/
/*Year 11 Levels of Porgress below, as and above expected*/
case when stuyear=11 and levelsofprogress < 3 then 1 else 0 end as belowexpected,
case when stuyear=11 and levelsofprogress >= 3 then 1 else 0 end as asexpected,
case when stuyear=11 and levelsofprogress >= 4 then 1 else 0 end as aboveexpected,
/*Year 10 Levels of Porgress below, as and above expected*/
case when stuyear=10 and levelsofprogress < 2 then 1 else 0 end as belowexpected,
case when stuyear=10 and levelsofprogress >= 2 then 1 else 0 end as asexpected,
case when stuyear=10 and levelsofprogress >= 3 then 1 else 0 end as aboveexpected,
/*Year 9 Levels of Porgress below, as and above expected*/
case when stuyear=9 and levelsofprogress < 1 then 1 else 0 end as belowexpected,
case when stuyear=9 and levelsofprogress >= 1 then 1 else 0 end as asexpected,
case when stuyear=9 and levelsofprogress >= 2 then 1 else 0 end as aboveexpected,
/*KS4 individual levels of progress from 0 or less through to 5 levels or greater */
case when (stuyear=9 or stuyear=10 or stuyear=11) and levelsofprogress <= 0 then 1 else 0 end as zeroorless,
case when (stuyear=9 or stuyear=10 or stuyear=11) and levelsofprogress = 1 then 1 else 0 end as onelevelprog,
case when (stuyear=9 or stuyear=10 or stuyear=11) and levelsofprogress = 2 then 1 else 0 end as twolevelprog,
case when (stuyear=9 or stuyear=10 or stuyear=11) and levelsofprogress = 3 then 1 else 0 end as threelevelprog,
case when (stuyear=9 or stuyear=10 or stuyear=11) and levelsofprogress = 4 then 1 else 0 end as fourlevelprog,
case when (stuyear=9 or stuyear=10 or stuyear=11) and levelsofprogress >= 5 then 1 else 0 end as fiveormore
From calcprogtotals