Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


I'm trying to print out schedules for students using mailmerge and have encountered a problem that I haven't yet been able to solve. Here's what I've done so far.

I have created a simple embedded database (named "school") in base and I have three tables named Classes, Students and Schedules. Classes has three fields: ClassID (which is the index), ClassTitle and CreditHours. The Students table has StudentID (the index), LastName and FirstName. The Schedules table has PairID (the index) and StudentID and ClassID.

Students and Classes are just what you'd expect. Each record in the Schedules table links one student and one class. A schedule is the collection of all classes for a particular student. I have created a simple query for the Schedules table:

SELECT "Schedules"."StudentID" "StudentID", "Students"."LastName" "LastName", "Students"."FirstName" "FirstName", "Schedules"."ClassID" "ClassID", "Classes"."ClassTitle" "ClassTitle", "Classes"."CreditHours" "CreditHours" FROM "Schedules" "Schedules", "Students" "Students", "Classes" "Classes" WHERE "Schedules"."StudentID" = "Students"."StudentID" AND "Schedules"."ClassID" = "Classes"."ClassID" ORDER BY "StudentID", "ClassID"

All of that works just fine and I've also created a simple report that uses the query, which also works as expected.

Now what I want to do is to create a separate schedule document for each student. I'm attempting to use mailmerge to do that. I have a simple .ott file which has "Schedule for <FirstName> <LastName>" in the header and then a table in the body of the document. It has a header and about 14 rows (the maximum number of classes I expect) and then a final row which has a formula which calculates the total number of credit hours.

When I select and filter one individual student, the schedule prints just fine, but if I try to generate all of them, it doesn't work as I want. Specifically, it picks up the first student's name but then it populates the table with the next 14 classes in the query, whether or not this *particular* student is taking that class or not. Each page is filled with 14 classes until we get to the end of the list.

Each row of the table includes the three fields and then a "Next record" which is probably where my problem lies. The condition is set to "TRUE". Somewhat schematically, each line looks like:

<school.Query_Schedules.ClassID> <school.Query_Schedules.ClassTitle> <school.Query_Schedules.CreditHours> <Next record:school.Query_Schedules>

Any clues would be most welcome. I'm quite new to LibreOffice and my SQL skills are very rusty, but I'd love to learn more about both if it helps me solve this problem!

Also, attached is a small zip file with both the database and template if you'd like to try.

Thanks!

Ed

--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.