![]() |
#1
|
|||
|
|||
![]()
I have two requirements for my merge:
1. I want to skip null records 2. I want to include text in non-null records. e.g. field "Boy4" is a number from a spreadsheet. If the field is null, I want to skip the record (to save space on my tickets) but if it's a number, I need to include text in front of the field like "Boys Aged Four: {MERGEFIELD Boy4}". I seem to be able to do one or the other but not both - I'm not sure where I'm going wrong and I'd appreciate any help. |
#2
|
||||
|
||||
![]()
If 0 isn't a valid result, you could code the SKIPIF field along the lines of:
{SKIPIF {MERGEFIELD Boy4}= 0} or: {SKIPIF «Boy4»= 0} Otherwise, you would probably need to code the SKIPIF field along the lines of: {SKIPIF {MERGEFIELD Boy4}<> {={MERGEFIELD Boy4}}} or: {SKIPIF «Boy4}<> {=«Boy4»}} Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. The spaces represented in the field construction are all required.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Many thanks.
I'm close now (especially thanks to your tip about the spaces being vital). The fields are now invisible if null but there is still a carriage return when the field is null (or zero). The code I've got is: Code:
{SKIPIF { MERGEFIELD Boy4 }="" }{ IF {MERGEFIELD Boy4 }<>""Boy Aged 4: {MERGEFIELD Boy4 }" "" } |
#4
|
|||
|
|||
![]()
A ha!
It seems I just need to put a carriage return in the code: Code:
{SKIPIF { MERGEFIELD Boy4 }="" }{ IF {MERGEFIELD Boy4 }<>""Boy Aged 4: {MERGEFIELD Boy4 }" "" } |
#5
|
||||
|
||||
![]()
Since you already have the SKIPIF test, I can't see the point of the further IF test. After all, the record will never appear if { MERGEFIELD Boy4 } is empty.
I also can't follow your IF field's syntax; it's spacing and quote characters are all over the place - you either have too many or too few quotes and too few spaces. It should be something like: { IF {MERGEFIELD Boy4 }<> "" "Boy Aged 4: {MERGEFIELD Boy4 }" "" } or, at an absolute minimum: {IF{MERGEFIELD Boy4}<> "" "Boy Aged 4: {MERGEFIELD Boy4}"}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]()
Oh, okay. I may've over-engineered the "solution".
I was just trying to ensure that if a field has no value (null) then it doesn't take up a line in the merge - it's not enough for it just not to appear. But yes, you're right - I had another go with just the "if, then" test and it works as I require. Thank you again for your patience. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ItsjustB | Excel | 1 | 01-09-2013 08:53 AM |
![]() |
moreenz | Word | 3 | 08-16-2012 02:41 PM |
Footer to Start on Page 1 - skip TOC | SQLUSA | Word | 4 | 08-12-2012 11:36 AM |
avoid duplicete record and merge the record with the existed record | hemant.behere | Excel | 0 | 01-10-2012 02:53 AM |
![]() |
karen h | Mail Merge | 10 | 03-23-2011 08:37 AM |