Assuming that CRM 4 uses a traditional Mail Merge main document as its
starting point, you can insert an IF field at the appropriate point in
the mail merge main document. A really simple example would be:
Dear { IF "{ MERGEFIELD genderfield }" = "F" "Madam" "Sir" }
where
a. each pair of {} are the special "field code braces" that you can
insert using ctrl-F9
b. you use the appropriate merge field instead of "genderfield"
c. you do the appropriate comparison, e.g. if you field stores numeric
0 or 1, you might need something like
Dear { IF { MERGEFIELD genderfield } = 0 "Sir" "Madam" }
d. you output the appropriate texts instead of Sir/Madam. And if it
isn't something really simple like Sir/Madam, that's likely to be the
trickiest part, which is why it is always worth considering storing one
or more salutations in your data. e.g. for some letters you may need
"Dear Sir", others you may need "Dear Mr"/"Mrs"/etc, and in some cases
you may know some people well enough to use "Dear Les", or even "Les:".
There may be a good reason to store the entire salutation (e.g. what if
you are doing multilingual output)
If you have more than 2 possible values in your gender field, e.g.
M/F/Unknown, you could use
Dear { IF "{ MERGEFIELD genderfield }" = "F" "Madam" "{ IF "{ MERGEFIELD
genderfield }" = "M" "Sir" "Sir/Madam" }
Alternatively (in either scenario), you could do something like this:
Dear { SET greetingM "Sir" }{ SET greetingF "Madam" }{ SET greetingU
"Sir/Madam" }{ REF "greeting{ MERGEFIELD genderfield }" }
Peter Jamieson
http://tips.pjmsn.me.uk