View Single Post
 
Old 03-24-2014, 01:15 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by jh32 View Post
Why does what appears to be the bottom half of the output come first?
Because it works that way... Basically, what happens is that each new group, except the first, triggers the output of the last part of the previous group's letter before the new group's first part is output.

If you expand the field code for the 'Using One Key' example from page 9 of the tutorial, except for the colouring, you'll see:
Code:
{QUOTE{IF{MERGESEQ}= 1 {SET Key ""} {SET LastKey {REF Key}}}{IF{MERGEFIELD State}<> {REF Key} "{IF{MERGESEQ}> 1 "↵

If you require more details about the above sales figures, please contact your {REF LastKey} Sales Manager.↵

Sincerely,↵


Customer Service Manager (National)↵
{DATE \@ "dddd, d MMMM yyyy"}↵
{IF{MERGEFIELD State}<> 0 {QUOTE 12}}"}{IF{MERGEFIELD State}<> 0 "Director,↵
Retail Sales {MERGEFIELD State}{SET Key {MERGEFIELD State}}↵
↵
These are the sales totals for {MERGEFIELD State \* Charformat}↵
↵
City Representative Sales↵
"}"}"{IF{MERGEFIELD State}<> 0 "{MERGEFIELD City} {MERGEFIELD Representative} {MERGEFIELD Sales \# $,0.00}↵
"}"}¶
In the above, the:
• green content outputs whatever goes at the start of each letter.
• orange content outputs the repeated data.
• red content outputs whatever goes at the end of each letter (technically, {IF{MERGEFIELD State}<> 0 {QUOTE 12}} is part of that).
• blue QUOTE field generates the page breaks between letters.
• purple fields manage whatever you use as the KEY to indicate a change of grouping.
• black content does the housekeeping, pulling all the others together and ensuring you don't get output being generated at the wrong time.
Although the whole field is depicted as a single paragraph with manual line breaks, there is nothing to stop you having multiple paragraphs with a variety of formatting, images, textboxes, etc. for the green and/or red portions.


Note: I've now closed this thread and moved later discussions to separate threads, as this thread was becoming quite long. If you need help with the issues discussed in this thread, please start a new one, linking to this one if necessary.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]