Friday 6 April 2012

Custom labels , part2

part one was here.

the next step was to get it into a mailmerge type of arrangement , linked to a dataabse , so editing, adding or removing entries was a simple business.
The database bit is easy - OOBase is good enough. So I set up a database of addresses ( usual stuff, firstname,lastname.address1, adress2  etc etc )
And the mailmerge works (!)  - with a bit of fiddling around - more later .




Taking the data from the Table in the database



You can add and remove names in the database viewed in the  template document   and sort entries alphabetically by the surname. but when it prints out from there , the names  are in the unsorted order.


The way to get them sorted is to add a Query  which will do the sorting

eg SELECT * FROM Addresses ORDER By "Last"  

and then get the database view to show the query - called here  inOrder



But if you do the mailmerge to the original document , the results is  blank pages.
The template for the mailmerge references the Table and field of the database table  that it was created from , not the current table/query/view even though the field names are the same .

the placeholder has the format <DB><TableName><ColumnName>

So to get it to merge from the query I had to change things from

<PDlabels><Addresses><First>  to  <PDlabels><inOrder><First>

and then copy the frame down the page 

So  the order of doing things has to be
  1.  Create and populate database
  2.  Write SQL query
  3.  Open template document
  4.  Drag column labels to the document. ( Copy/paste across as before) 
  5.  I then found that I had to tell the mailmerge where to  put the next record - otherwise it was  producing a complete page of the same name . The explanation is here .

Ctrl -f2 gets you to the correct screen



So i think I'm sorted !


No comments:

Post a Comment