Unfortunately, you can't conditionally insert SEQ-numbered paragraphs and be ensure of a valid numbering sequence. What you'll get if there are no oranges, for example, is:
- There are 32 apples.
- There are 3 pears.
and the SEQ field will no longer be present.
You could, however, use a set of fields coded like:
{SET Val 0}{IF{MERGEFIELD Apples}> 0 "{SET Val {=Val+1}}{Val # 0} There are {MERGEFIELD Apples} apples¶
"}{IF{MERGEFIELD Oranges}> 0 "{SET Val {=Val+1}}{Val # 0} There are {MERGEFIELD Oranges} oranges¶
"}{IF{MERGEFIELD Pears}> 0 "{SET Val {=Val+1}}{Val # 0} There are {MERGEFIELD Pears} pears¶
"}
or, with more sophistication:
{SET Val 0}{IF{MERGEFIELD Apples}> 0 "{SET Val {=Val+1}}{Val # 0} There {={MERGEFIELD Apples}-1 # "'are';;'is'"} {MERGEFIELD Apples} apple{={MERGEFIELD Apples}-1 # "'s';;"}¶
"}{IF{MERGEFIELD Oranges}> 0 "{SET Val {=Val+1}}{Val # 0} There {={MERGEFIELD Oranges}-1 # "'are';;'is'"} {MERGEFIELD Oranges} orange{={MERGEFIELD Oranges}-1 # "'s';;"}¶
"}{IF{MERGEFIELD Pears}> 0 "{SET Val {=Val+1}}{Val # 0} There {={MERGEFIELD Pears}-1 # "'are';;'is'"} {MERGEFIELD Pears} pear{={MERGEFIELD Pears}-1 # "'s';;"}¶
"}
In the above constructions, it's the {Val # 0} field that outputs the sequential numbers. The {SET Val 0} field at the start resets the numbering for each merge record and the {SET Val {=Val+1}} increments it only if the field has a value > 0.
Note: The field brace pairs (i.e. '{ }') for the above examples are 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. The spaces represented in the field constructions are all required. Instead of the ¶, you should use real line/paragraph breaks.