Change merge document based on condition

H

Hefe311 Jen

Hello,

I have a merge letter that includes a table with merge fields in it. I
wanted to know if I could delete that table and add another table based on
one of the fields in my data source. Similar situations are in other
threads, but not where you actually replace a table with another table based
on a condition, so I'm not sure if this would even be possible.

Any ideas?
 
P

Peter Jamieson

Well, you wouldn't delete one table and add another, so much as use an IF
field to decide whether to use one chunk of text+fields+tables+anything else
rather than another.

e.g. if you normally want table A but when Mergefield X is "Y" you don't
want table A but you do want table B, you could use

{ IF { MERGEFIELD X } = "Y"
"insert table B here"
"insert table A here" }
 
H

Hefe311 Jen

So do both tables print out on the document? From your reply it doesn't
sound like it, but I guess I'm confused as to where table B would hang out
until MERGEFIELD = "N".
 
P

Peter Jamieson

So do both tables print out on the document?

No.
From your reply it doesn't
sound like it, but I guess I'm confused as to where table B would hang out
until MERGEFIELD = "N".

Think of it like this. If you have

before{ IF { MERGEFIELD X } = "Y" "A" "B" }after

then in your output, if X is "Y" you will see

beforeAafter

(B isn't in the output)

and if X is not "Y" you will see

beforeBafter.

(A isn't in the output)

All you are really doing is putting a whole table instead of A and another
one instead of B. Generally speaking, any fields inside the table that is
displayed will be evaluated. However, do not assume that fields in B will
not be evaluated just because the results are thrown away - some field types
such as SEQ may in fact be executed. I don't know why.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top