Ask Your Question
1

How do I remove inserted characters, such as comma, from labels with no records in a mail merge? [closed]

asked 2014-01-10 16:47:28 +0100

kbalkcom gravatar image

updated 2014-01-11 02:24:05 +0100

bencomp gravatar image

Trying to do a mail merge on labels in writer for addresses. I have to insert characters, for example the "," between city and state. At the end of my records, the comma is printed on all remaining labels for that page. I want to suppress that because I am at the end of the records. I think it has something to do with Hidden Paragraphs, but can't get it to work. Any suggestions?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-18 13:54:43.797411

1 Answer

Sort by » oldest newest most voted
0

answered 2014-01-11 02:23:29 +0100

bencomp gravatar image

What you are looking for is Conditional text, as explained on the LibreOffice wiki page Defining Conditions in the section about conditional text based on the contents of a database field. In your example of ", " between city and state you could adapt the first series of steps to apply them to a labels document like so:

  1. Choose File - New - Labels and choose the type of labels etc.
  2. Leave the inscription empty, but make sure the checkbox Address is checked.
  3. On the Options tab, make sure the checkbox Synchronize contents is checked.
  4. Create the document by clicking New Document
  5. Choose Insert - Fields - Other, and then click the Database tab.
  6. In the Type list, click "Mail merge fields".
  7. In the Database selection box, double-click an address book, click "City", and then click Insert. Repeat for "State".
  8. In the document, place the cursor between the two fields, and then return to the Fields dialog.
  9. Click the Functions tab, and then click "Conditional text" in the Type list.
  10. In the Condition box, type: "Addressbook.addresses.State". This condition results in TRUE when State is non-empty in the current record.
  11. In the Then box, type a comma and space and leave the Else box blank.
  12. Click Syncronize Labels in the floating window.

When you now select the rows that you want to print labels for from the Data source view and click Data to fields, the labels are filled with database data. I see that the labels that do not have an address, do get a conditional comma.

Apparently, the labels wizard adds Next record to the end of each label to make LibreOffice progress to the next record. This also happens after the last real record so that the "empty" labels have a record number that is one higher than the last real label's number. I am unsure why the condition for printing the comma is true.

As a workaround, you could create a query that combines city and state with a comma into a string that can be printed unconditionally.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-01-10 16:47:28 +0100

Seen: 2,640 times

Last updated: Jan 11 '14