ok...here is my approach...it is not the only approach but I think it should work fine.
So if I read you correctly all of the marks for a subject are contained in a single record
then you should group your report as follows:
Reportheader - (suppressed)
Pageheader - (suppressed)
GroupHeader1 - Teacher ID (suppressed)
GroupHeader2 - Student ID (suppressed)
GroupHeader3 - Subject (suppressed)
detail (suppressed)
GroupFooter3 - (suppressed)
GroupFooter2 - (not suppressed...this for label info)
GroupFooter1 - (suppressed)(enable "New Page After"

PageFooter - (suppressed)
ReportFooter - (suppressed)
to gather the information we will create variables and we will print these variables after every second student...that way we can get 2 labels side-by-side. We cannot store ALL the student information since it would be too difficult to create labels...but this should work fine
to control the reset and printing of the label information we shall use a counterflag in a formula as follows:
*****************************************************
@counterflagInitalize (placed in the report header)
WhilePrintingRecords;
numberVar countFlag := 0;
*****************************************************
the following will initialize the variable/arrays we need. the arrays will store the marks for each subject
*****************************************************
@Initialize (placed in the Group2Header)
WhilePrintingRecords;
numberVar countFlag ;
if countFlag = 0 then
(
stringVar Student_1 := "";
//array elements are sw1,sw2,sw3,sw4,sw5,sw6,final
stringVar array S1_Math := ["","","","","","",""];
(... add in the other 6 subjects... eg. S1_Lang)
stringVar Student_2 := "";
stringVar array S2_Math := ["","","","","","",""];
(... add in the other 6 subjects...)
countFlag := 1;
);
*****************************************************
now we collect Student Information
*****************************************************
@StudentInfo (placed in the Group2header)
WhilePrintingRecords;
evaluateAfter(@Initialize);
numberVar countFlag ;
stringVar Student_1 ;
stringVar Student_2;
if countFlag = 1 then
Student_1 := {table.SName} + "" + {table.StudentID}
else if countFlag = 2 then
Student_2 := {table.SName} + "" + {table.StudentID};
*****************************************************
Now we create the marks information gathering formula
*****************************************************
@GatherMarksInfo (placed in the detail section)
WhilePrintingRecords;
numberVar countFlag ;
stringVar array S1_Math ;
(...Plus the other 6 subject arrays....)
stringVar array S2_Math ;
(...Plus the other 6 subject arrays....)
if countFlag = 1 then
(
if {table.subject} = "Math" then
(
S1_Math[1] := {table.sw1};
S1_Math[2] := {table.sw2};
S1_Math[3] := {table.sw3};
...
S1_Math[7] := {table.Final};
)
else if {table.subject} = "Language" then
(
S1_Lang[1] := {table.sw1};
S1_Lang[2] := {table.sw2};
S1_Lang[3] := {table.sw3};
...
S1_Lang[7] := {table.Final};
)
[...repeat this structure for all subjects...]
)
else if countFlag = 2 then
(
if {table.subject} = "Math" then
(
S2_Math[1] := {table.sw1};
S2_Math[2] := {table.sw2};
S2_Math[3] := {table.sw3};
...
S2_Math[7] := {table.Final};
)
else if {table.subject} = "Language" then
(
S2_Lang[1] := {table.sw1};
S2_Lang[2] := {table.sw2};
S2_Lang[3] := {table.sw3};
...
S2_Lang[7] := {table.Final};
)
[...repeat this structure for all subjects...]
);
***********************************************
Now we have all our information stored...
to create the labels we require several formuals for each label...the reason is that not all marks will have the same number of characters (eg. one could have an A or A+ so it is impossible to garuantee a nice alignment if they were concatonated together since spaces and characters are treated differently in most fonts.
you require 2 formulas one for each label I will only show Student 1 values
@DisplayStudent1_info
WhilePrintingRecords;
stringVar Student_1 ;
"Student: " + Student_1;
***********************************************
@DisplaySubjectLabels (enable the Field "Can Grow"
//the first carriage return is to advance one line before
//printing (so the sw1 label won't interfere).
chr(13)+ chr(10) + "Math" + chr(13)+ chr(10) + "Science" +
chr(13)+ chr(10) + (...add in the rest of the subjects...);
***********************************************
@DisplayStudent1_SW1 (enable the Field "Can Grow"
WhilePrintingRecords;
stringVar array S1_Math ;
(...Plus the other 6 subject arrays....)
"sw1" + chr(13) + chr(10) + S1_Math[1]+ chr(13) + chr(10)+
S1_Science[1] + (...add in the rest of the subjects...);
***********************************************
Note: the same structure is repeated for SW2 to Final marks
Repeat for Student 2 and arrange the formulas in the labels appropriately.
NOW COMES AN IMPORTANT STEP...We want to suppress the Group2 Footer unless countFlag is equal 2 OR we are on the last record
In the conditional suppress for the Group2 footer, place this formula:
WhilePrintingRecords;
NumberVar countFlag;
NumberVar temp;
temp := countFlag;
countFlag := countFlag + 1;
if countFlag = 3 then countFlag := 0;
//the last statement controls wheter or not the suppress is
//done
if temp = 1 then true;
I think that is all....perhaps I have missed something or you may have questions....just ask if something isn't clear.
Jim Broadbent