Page 1 of 1

[Solved] Alphabetize names for mail merge

Posted: Wed Dec 07, 2022 5:13 pm
by KeithSloan
I have the same problem but my address are stored in a database.

The mail merge seems to use the Primary Key which for me is a number that represents the order the records were created, where as I wish to have the Mail Merge use the addresses sorted by last name.

I have tried to create a different view with where my plan was to some how tell the mail merge to use the View rather than the database but I
failed on both counts. I did not find creating a view at all intuitive and could not see how it could be selected in the mail merge which just offers databases.

Re: Alphabetizing a mailing list

Posted: Wed Dec 07, 2022 5:28 pm
by Hagar Delest
Hi and welcome to the forum!

I have split your topic from Alphabetizing a mailing list, since it is not related to your current issue, that deals with mail merge.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 6:16 pm
by John_Ha
Sorting the names in the database should be possible. The manual should say how to do it.

If you cannot sort in the database, brute force and ignorance suggests export the addresses to a .csv file. Import the .csv file into Calc. Sort in Calc. Use the spreadsheet as the source for the mail merge. Alternatively import them in the sorted order to a new database.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 6:21 pm
by KeithSloan
John_Ha wrote: Wed Dec 07, 2022 6:16 pm Sorting the names in the database should be possible. The manual should say how to do it.

If you cannot sort in the database, brute force and ignorance suggests export the addresses to a .csv file. Import the .csv file into Calc. Sort in Calc. Use the spreadsheet as the source for the mail merge. Alternatively import them in the sorted order to a new database.
I can sort the names in the database but mail merge ignores and just uses the primary key as far as I can tell.

As to brute force approach, that is not very satisfactory as each time I add a new address I would have to go through that process.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 6:37 pm
by John_Ha
Can you add a second key which is alphabetical.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 6:42 pm
by KeithSloan
John_Ha wrote: Wed Dec 07, 2022 6:37 pm Can you add a second key which is alphabetical.
possibly but how do you tell mail merge to use that key?

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 7:04 pm
by MrProgrammer
KeithSloan wrote: Wed Dec 07, 2022 5:13 pm I wish to have the Mail Merge use the addresses sorted by last name.
Create a query which returns the data you want in the order you want. Use the query as the data source for the merge. I won't be able to help further until next week since I won't have access to my computer until then.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 7:05 pm
by KeithSloan
MrProgrammer wrote: Wed Dec 07, 2022 7:04 pm
KeithSloan wrote: Wed Dec 07, 2022 5:13 pm I wish to have the Mail Merge use the addresses sorted by last name.
Create a query which returns the data you want in the order you want.
But how do I tell mail merge to use the query, it just offers me databases.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 7:12 pm
by KeithSloan
KeithSloan wrote: Wed Dec 07, 2022 7:05 pm
MrProgrammer wrote: Wed Dec 07, 2022 7:04 pm
KeithSloan wrote: Wed Dec 07, 2022 5:13 pm I wish to have the Mail Merge use the addresses sorted by last name.
Create a query which returns the data you want in the order you want.
But how do I tell mail merge to use the query, it just offers me databases.
I would attach an screen shot image but it is 153Kb and the forum limit is 128Kb

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 8:08 pm
by Hagar Delest
Crop it or reduce its color depth.
Or use a 3rd party web site to share files.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 8:13 pm
by Villeroy
menu:Edit>Exchange Database... lets you define the source table or query.
You can also sort the record set in the mail merge dialog: Print the serial letter, confirm serial letter, mark the sort column and click the sort button A-Z or Z-A.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 9:11 pm
by KeithSloan
Villeroy wrote: Wed Dec 07, 2022 8:13 pm menu:Edit>Exchange Database... lets you define the source table or query.
You can also sort the record set in the mail merge dialog: Print the serial letter, confirm serial letter, mark the sort column and click the sort button A-Z or Z-A.
Where do I find print the serial letter?

The mail merge is creating a document with the labels filled out with from the database, when. I go to print, the labels are already in the order
as per the primary key.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 11:48 pm
by Villeroy
When you print a document with mail merge fields, a message box pops up if you want to print a serial letter with options [Yes], [No], [Cancel]
[Yes] pops up another dialog where you can specify details about the records to be printed and about the ouput medium being a printer, a file or separate files for each record. Here you can filter and sort the record set.
[No] prints one copy of the document with place hodlers as visible on screen.

Re: Alphabetizing a mailing list for mail merge

Posted: Wed Dec 07, 2022 11:57 pm
by KeithSloan
Not seeing anything like that here.

From the labels.odt document I go Tools | Mail Merge Wizard

Then through a series of options and then it creates a new document filled out with info from the database. I can view and edit the new document.
If I print it does not perform any popups OpenOffice 4.1.13 on a Mac.

Re: Alphabetizing a mailing list for mail merge

Posted: Sun Dec 11, 2022 2:05 am
by MrProgrammer
KeithSloan wrote: Wed Dec 07, 2022 5:13 pm The mail merge seems to use the Primary Key which for me is a number that represents the order the records were created, where as I wish to have the Mail Merge use the addresses sorted by last name.
I used File → New → Database → Create a new database to create a toy database in a Base document with a primary ID field, first name, and last name. I also used File → New → Labels to create labels in a Writer document with first name and last name Mail Merge fields. The database records are in the order they were entered, not in alphabetical order.

MrProgrammer wrote: Wed Dec 07, 2022 7:04 pm Create a query which returns the data you want in the order you want.
I created and saved this query for the database to retrieve the records in last name order. When I ask Base to display the data from the query, it shows the records in order by last name.
202212101747Q.gif
202212101747Q.gif (92.26 KiB) Viewed 8881 times

KeithSloan wrote: Wed Dec 07, 2022 7:05 pm But how do I tell mail merge to use the query, it just offers me databases.
I opened the label document, then used Edit → Exchange database to use the query that I saved in the Base document. Note the difference in the icons proceeding Addresses and Query_Addresses.
202212101747E.gif
202212101747E.gif (39.78 KiB) Viewed 8881 times

Villeroy wrote: Wed Dec 07, 2022 11:48 pm When you print a document with mail merge fields, a message box pops up if you want to print a serial letter with options
KeithSloan wrote: Wed Dec 07, 2022 11:57 pm Not seeing anything like that here. From the labels.odt document I go Tools | Mail Merge Wizard …
Your process is incorrect. I do not need the Tools → Mail Merge Wizard because I have already used the File → New → Labels wizard. After setting the label document to use the query, when I use File → Print on my Mac I get this dialog box. When I answer Yes and print the labels, they are in order by last name.
202212101747P.gif
202212101747P.gif (23.89 KiB) Viewed 8881 times


If you need any additional assistance attach your documents demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself). I will not help further unless you attach. We will need you to attach a Base document and a Writer document (the label template). If your Base document points to an external database, you'll need to attach that data too.