Prikrivanje praznih polj Naslov2 v spojenih dokumentih

From Apache OpenOffice Wiki
Jump to: navigation, search

Tule je primer težave, ki jo želimo rešiti. Nekateri naslovi imajo dve vrstici naslova, drugi pa tri.

Janez Primer Marija Primer
Glavna ulica 101 Stranska ulica 102
Soba 55 1111 Spodnji Kraj
2222 Zgornji Kraj


Ker pa gre za spajanje dokumentov, morate za vsakega prejemnika vnesti polje <Naslov2>. The setup has to be the same.

<Firstname> <Lastname>
<Address1>
<Address2>
<City>, <State>, <Zip>


But with this approach, your addresses look like this.

Bob Jones Marion Silverman
101 Main 888 105th Ave
Suite 55
Boulder, CO 80022 Broomfield, CO 82211


How do you suppress that second Address2 line and the corresponding carriage return if there is no content for a particular record, for that Addres2 field?

Here is the guide, using an example of labels.

1. Create the labels for mail merge as usual. File > New > Labels, select your database and tables, insert the fields, etc.(See Creating Mail Merge Documents From Text/CSV or Spreadsheets)

2. Choose the Synchronize Contents checkbox.

3. Click New Document. The labels will appear.

4. Turn on nonprinting characters if they are not on already, by choosing View > Nonprinting Characters.

5. Select the first soft return, shown selected.
Label with soft returns

6. Press Return or Enter to replace it with a hard return.

7. Repeat, to make them all hard returns.

8. Click Synchronize Labels to update the other labels to be the same.

9. Select the Address2 field.

10. Choose Insert > Section.

11. Name the new section Suppress. Select the Hide checkbox and type the following condition.

  databasename.tablename.fieldname EQ ""    

The names are case sensitive and the last part is two double quotes together.


Example:

databasename = DatabaseWithTwoAddresslines

tablename = Table1

fieldname = Address2

Documentation note.png If you are using the Thunderbird address book as a data source, you need to use square brackets if the field name includes a space (i. e.:[Address 2]=="" ) to hide the second line of the address if the Address 2 field is blank. In general, avoid field, table, or database names with spaces.

12. Click Insert.

13. Click Synchronize Labels.

14. Now preview the data or print the data.

If you need to change the section, select it in the first address and choose Format > Section. Select the one named Suppress for the master label and make changes, then click OK. Click Synchronize labels again.

Tip.png Here is another way to suppress blank Address2 fields: After having replaced the soft returns by hard returns click at the end of the Address2 paragraph. Then choose Insert > Fields > Other, select the Functions tab and click on Hidden Paragraph in the Type column. In the Condition box enter the condition that defines a blank address field. It has the general form of:
 ![databasename.tablename.fieldname]

Now click Insert and Close buttons, and Synchronize Labels as before.



This How To comes from Solveig Haugland's Blog

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools