S
Sabba
TESTRESULTS
PRE
STUDENT
@sID=1
@Score=5
STUDENT
@sID=2
@Score=2
STUDENT
@sID=3
@Score=2
POST
STUDENT
@sID=1
@Score=2
STUDENT
@sID=2
@Score=5
STUDENT
@sID=3
@Score=5
SORTCRITERIA
SORT
@GroupID=1
STUDENT
@sID=1
STUDENT2
@sID=2
SORT
@GroupID=2
STUDENT
@sID=3
For each
SORTCRITERIA/SORT
I want a sum of
TESTRESULTS/POST/STUDENT[@sID=current()/STUDENT/@sID]/@Score
minus
TESTRESULTS/PRE/STUDENT[@sID=current()/STUDENT/@sID]/@Score
BUT ONLY WHEN
A students POST score is greater than their PRE score. In other words,
I want to ignore changes that weren't positive. The structure is so
that I can define (dynamically) how to group students (school, grade,
gender, etc...) seperate from the students data that needs to be
crunched. This allows me to add grouping criteria in one place and the
report adapts (obviously there's more to the actual data, but it's not
relevant here).
Below is the closest I can come, but it requires a syntax that I don't
think is valid, a predicate in a predicate (scope issues). I'm hoping
someone can help me find a solution that can be implemented in a single
XPATH statement. $SORTELEMENT contains a SORT element as seen above
(I'm doing a for-each SORTCRITERIA/SORT). I ignored the
SectionSummary/Ba above because they exist only once in this dataset.
For the first SORTCRITERIA/SORT, the sum would be 3 (not 0), the 2nd
SORT would be 3.
Thanx in advance.
What I have so far (please don't flame, I know how bad it looks)....
round(((sum(/ROOT/POST/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore[../@ScaledScore >
/ROOT/PRE/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore] -
/ROOT/PRE/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore[../@ScaledScore <
/ROOT/POST/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore] ) div
count(/ROOT/POST/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore) ) ) * 10 ) div 10
PRE
STUDENT
@sID=1
@Score=5
STUDENT
@sID=2
@Score=2
STUDENT
@sID=3
@Score=2
POST
STUDENT
@sID=1
@Score=2
STUDENT
@sID=2
@Score=5
STUDENT
@sID=3
@Score=5
SORTCRITERIA
SORT
@GroupID=1
STUDENT
@sID=1
STUDENT2
@sID=2
SORT
@GroupID=2
STUDENT
@sID=3
For each
SORTCRITERIA/SORT
I want a sum of
TESTRESULTS/POST/STUDENT[@sID=current()/STUDENT/@sID]/@Score
minus
TESTRESULTS/PRE/STUDENT[@sID=current()/STUDENT/@sID]/@Score
BUT ONLY WHEN
A students POST score is greater than their PRE score. In other words,
I want to ignore changes that weren't positive. The structure is so
that I can define (dynamically) how to group students (school, grade,
gender, etc...) seperate from the students data that needs to be
crunched. This allows me to add grouping criteria in one place and the
report adapts (obviously there's more to the actual data, but it's not
relevant here).
Below is the closest I can come, but it requires a syntax that I don't
think is valid, a predicate in a predicate (scope issues). I'm hoping
someone can help me find a solution that can be implemented in a single
XPATH statement. $SORTELEMENT contains a SORT element as seen above
(I'm doing a for-each SORTCRITERIA/SORT). I ignored the
SectionSummary/Ba above because they exist only once in this dataset.
For the first SORTCRITERIA/SORT, the sum would be 3 (not 0), the 2nd
SORT would be 3.
Thanx in advance.
What I have so far (please don't flame, I know how bad it looks)....
round(((sum(/ROOT/POST/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore[../@ScaledScore >
/ROOT/PRE/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore] -
/ROOT/PRE/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore[../@ScaledScore <
/ROOT/POST/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore] ) div
count(/ROOT/POST/SectionSummary/Ba/St[@StudentID =
$SORTELEMENT//STUDENT/@StudentID]/Sec/@ScaledScore) ) ) * 10 ) div 10