Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get Variable to print with desired record

Status
Not open for further replies.

Hillary

Programmer
Feb 15, 2002
377
US
Hi all,

I am working with a report that has Attendance Values printing at the bottom of each student's record. I have been asked to move the Attendance Values up to the Page Header. I created a Variable and I get either 1 of 2 results depending on if I use WhilePrintingRecords or WhileReadingRecords in my formula; either the last student's Attendance Values print in the Page Header for each student or the student's Attendance Values print in the Page Header for the next student (ex. the first student has no attendance in the Page Header; the second student has the 1st student's Attendance Values in the Page Header; etc...)

This report came with the software. There is one Group {Data.DefaultStudentSort}. The Attendance is in Detail i with a Section Suppress {Data.Kind} <> {@DetailTypeAttendance}

My formulas are...

1. (placed in Detail i)
WhilePrintingRecords;
Global StringVar Course;
Global StringVar GradeItem;
Global StringVar TotalCredit;
Global StringVar AttnValues;
//WhileReadingRecords;
If {Data.Kind} = {@DetailTypeCourseName} then Course :={Data.P1};
If {Data.Kind} = {@DetailTypeGradeItem} then GradeItem :={Data.P1};
If {Data.Kind} = {@DetailTypeTotalCredits} then TotalCredit :={Data.P1};
If {Data.Kind} = {@DetailTypeAttendance} then AttnValues :={Data.P1};

2. (placed in the Page Header)
WhilePrintingRecords;
Global StringVar AttnValues;

CR 9.0

Thanks for your help!

Hillary
 
If there is one value for {Data.P1} for {@DetailTypeAttendance} per student then all you need to do is use a formula like:

//{@attend}:
If {Data.Kind} = {@DetailTypeAttendance} then {Data.P1}

...in the detail section. Right click on this formula and insert a maximum at the student level, and drag it into a student group header_a section (which can appear like a page header). Or create a formula and add it to the page header.

maximum({@attend},{table.student})

This would work as long as you have a new page after set on the student group footer.

-LB
 
WhilePrintingRecords formulas cannot be placed in a group header with correct results.

Create a separate formula for AttnValues:
// formula: @AttnValues
If {Data.Kind} = {@DetailTypeAttendance} then
{Data.P1} else 0

Place this formula in the detail section. Right click on the formula and Insert > Summary > Sum and select the student group footer.

I am assuming you are doing a page break at student id if you want the total in the page header, so go ahead and move the new sum subtotal for data.p1 to the page header.

MrBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top