MarvInBoise was telling us:
MarvInBoise nous racontait que :
Thank you for your help, I have the paragraphs pulling correctly with
your help!
My next challenge: If I have all 8 fields equal "Y", then I don't
want anything to generate (like the entire letter); just pulling in
various paragraphs with the other testing.
Second challenge: If 4 of the fields are equal "Y", then I have a
second page to the letter I do not want generated.
So, can I test of all 8 fields are Y and enclose my entire letter in
quotes? Can I do the same thing for the second page?
Thanks so much; you have been a trememdous help!
Dealing with 8 fields that needs to be nested with IF fields is quickly
going to lead to a nightmare if you are not organized.
Personally I would try VBA instead, but it can be done if you are methodical
and you are clear on what you want.
For example, if you want all 8 fields to be true, then you need something
like:
{IF {MERGEFIELD 1} = "Y" "{IF {MERGEFIELD 2} = "Y" "{IF {MERGEFIELD 3} = "Y"
"{IF {MERGEFIELD 4} = "Y" "{IF {MERGEFIELD 5} = "Y" "{IF {MERGEFIELD 6} =
"Y" "{IF {MERGEFIELD 7} = "Y" "{IF {MERGEFIELD 8} = "Y" "All are Y" "1-7 are
Y, but not 8"}" "1-6 are Y, but not 7"}" "1-5 are Y, but not 6"}" "1-4 are
Y, but not 5"}" "1-3 are Y, but not 4"}" "1-2 are Y, but not 3"}" "1 is Y,
but not 2"}" "All not Y"}
This works, but only sequentially, i.e. If 1,2,3 are Y, 4 is not, 5 to 8
are, you will get "1-3 are Y, but not 4", which does not tell you anything
about 5 to 8. For that, you need to test all other fields again in each "IF
NOT" part:
{IF {MERGEFIELD 1} = "Y" "{IF {MERGEFIELD 2} = "Y" "{IF {MERGEFIELD 3} = "Y"
"{IF {MERGEFIELD 4} = "Y" "{IF {MERGEFIELD 5} = "Y" "{IF {MERGEFIELD 6} =
"Y" "{IF {MERGEFIELD 7} = "Y" "{IF {MERGEFIELD 8} = "Y" "" "1-7 are Y, but
not 8"}" "1-6 are Y, but not 7"}" "1-5 are Y, but not 6"}" "1-4 are Y, but
not 5"}" "1-3 are Y, but not 4"}" "1-2 are Y, but not 3"}" "1 is Y, but not
2"}" "{IF {MERGEFIELD 2} <> "Y" "1 and 2 are not Y" "1 is not Y but 2 is
Y"}"}
Here I take into consideration the status of the second field in relation
with the first one, but not with the others.
Honestly, if you need all possible outcomes, this will quickly become a
nightmare...
If all you care about is if all are Y then use the first example and replace
all the text between quote with nothing. This means that as soon as one is
not Y or all of them are Y, nothing will appear.
Then, repeat with only 4 fields for the second page (Although I am still not
clear with this).
If you need to test for every possible combination between the 8 fields, I
think it would be safer with a macro, at least for me. I know that macropod
likes to do everything with fields and has a mind that can wrap itself
around all those different fields combination that you would need in that
case. If that it the case, start a new thread explaining in details what is
the relationships between the merge fields value and the text that should be
displayed and I am sure that as soon as he sees it, he will jump on board to
help.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org