Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Hi Lara,
Part of the limitation of Word's OR test is that it only supports two conditions, as others have pointed out. This applies to AND tests also. There is another way, though. Instead of using OR, you could use a numeric test. For example: {IF{={IF{MAILMERGE County}= "County1" 1 0}+{IF{MAILMERGE County}= "County2" 1 0}+{IF{MAILMERGE County}= "County3" 1 0}+{IF{MAILMERGE County}= "County4" 1 0}+{IF{MAILMERGE County}= "County5" 1 0}+{IF{MAILMERGE County}= "County6" 1 0}+{IF{MAILMERGE County}= "County7" 1 0}+{IF{MAILMERGE County}= "County8" 1 0}} 0 "True Statement" "False Statement"} In this case, adding the result of each IF test works the same as a series of OR tests. Granted, you'll have nine IF tests, but you only need one true (and perhaps one false) output statement. Cheers "Lara Z" wrote in message ... I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#2
|
|||
|
|||
Hi Peter & Greg,
In either case, you're going to need to set the 'County' value via the mailmerge. Unless you're planning to do this via a SET field that I haven't seen explained (eg {SET County {MAILMERGE CountyName}}), you'd both need to use {MAILMERGE County} instead of {County}. Cheers "Peter Jamieson" wrote in message ... You can probably simplify that using COMPARE via e.g. { IF { =({ COMPARE { County } = "Hillsborough" }+{ COMPARE { County } = "Pineallas" }+{ COMPARE { County } = "Lake" }+{ COMPARE { County } = "Orange""1""0" }+{ COMPARE { County } = "Brevard" }+{ COMPARE { County } = "Indian River" }+{ COMPARE { County } = "Volusia" }+{ COMPARE { County } = "Oceola" }) } 0 "Test Sat" "Test Unsat" } Peter Jamieson "Greg Maxey" wrote in message ... Lara, I found some material that I had squirreled away on Word math fields. A bright fellow that goes by Macropod shows us a relatively simple process: { If { =({ IF { County } = "Hillsborough""1""0" }+{ IF { County } = "Pineallas""1" "0"}+{ IF { County } = "Lake""1""0" }+{ IF { County } = "Orange""1""0" }+{ IF { County } = "Brevard""1""0" }+{ IF { County } = "Indian River""1""0" }+{ IF { County } = "Volusia""1""0" }+{ IF { County } = "Oceola""1""0" }) } 0 "Test Sat""Test Unsat } Basically you just set up 8 condition equal 0 or 1 and add then up. One and only one can be 1 and if any one is 1 then the condition {=(1)} 0 is met and the true result displayed. As mentioned earlier, you should replace "Test Sat" with an IncludeText field or AutoText field. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Lara Z wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#3
|
|||
|
|||
using "OR" field?
I am trying to code a merge document that will insert an additional two-page
document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#4
|
|||
|
|||
I'm new to this stuff, but as far as I can tell the operator is simply:
Or -smcash "Lara Z" wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#5
|
|||
|
|||
Yes, obviously, but if this is a valid operator what is the syntax for using
it - either in general or with my example, as everything I have tried has not worked...?? I tried the following and it does not work, i.e., does not return "Test Positive" or "Test Negative" . { IF { = OR ({MERGEFIELD "County"}="Hillsborough", {MERGEFIELD "County"}="Pinellas")} =1 "Test Positive" "Test Negative"} "smcash" wrote in message ... I'm new to this stuff, but as far as I can tell the operator is simply: Or -smcash "Lara Z" wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#6
|
|||
|
|||
Ok, I noticed a few things. First you need to use a COMPARE, and you've got
some quotes out of place. Here is what I did: {IF { = OF ( { COMPARE "{ MERGEFIELD County }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD County }" = "Pinellas" } ) } = 1 "Test Positive" "Test Negative" } Also, you can't just type the curly braces, but must insert them with Ctrl+F9. But you probably knew that already. -smcash "Lara Z" wrote: Yes, obviously, but if this is a valid operator what is the syntax for using it - either in general or with my example, as everything I have tried has not worked...?? I tried the following and it does not work, i.e., does not return "Test Positive" or "Test Negative" . { IF { = OR ({MERGEFIELD "County"}="Hillsborough", {MERGEFIELD "County"}="Pinellas")} =1 "Test Positive" "Test Negative"} |
#7
|
|||
|
|||
Oops, I mistyped OR. Where I wrote OF, it is obviously supposed to be OR.
|
#8
|
|||
|
|||
try
{ IF { =or({ COMPARE "{ MERGEFIELD "County" }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD "County" }" = "Pinellas" }) } = 1 "Test positive" "Test Negative" } if you ave a thrid comparison, you will need a second OR, e.g. { IF { =or(or({ COMPARE "{ MERGEFIELD "County" }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD "County" }" = "Pinellas" }) , { COMPARE "{ MERGEFIELD "County" }" = "County3" }) } = 1 "Test positive" "Test Negative" } Unwieldy, isn't it? Just a suggestion, but if you are inserting form a separate file you might be better off using the result of the { =} field as part of the file name, e.g. if you have Counties0.doc and Counties1.doc you might use { INCLUDETEXT "c:\\mydocs\\Counties{{ =or(or({ COMPARE "{ MERGEFIELD "County" }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD "County" }" = "Pinellas" }) , { COMPARE "{ MERGEFIELD "County" }" = "County3" }) }.doc" or you can use 2 bookmark names within a single file to achive something similar. Peter Jamieosn "Lara Z" wrote in message ... Yes, obviously, but if this is a valid operator what is the syntax for using it - either in general or with my example, as everything I have tried has not worked...?? I tried the following and it does not work, i.e., does not return "Test Positive" or "Test Negative" . { IF { = OR ({MERGEFIELD "County"}="Hillsborough", {MERGEFIELD "County"}="Pinellas")} =1 "Test Positive" "Test Negative"} "smcash" wrote in message ... I'm new to this stuff, but as far as I can tell the operator is simply: Or -smcash "Lara Z" wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#9
|
|||
|
|||
Lara,
These are ugly at best :-) You could use something like: { IF { IF { County }="Pinellas""Set"{ IF { County }=" Hillsborough""Set"{ IF { County }="Lake""Set"{ IF { County }="Orange""Set"{ IF { County }="Brevard""Set"{ IF { County }="Indian River""Set"{ IF { County }="Volusia""Set"{ IF { County }="Osceola""Set" } } } } } } } }="Set"{ IncludeText "C:\\Your Folder\\Your File Name.doc"}"Test Failed/Leave Blank"} "Set" is just an arbitary word I picked. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Lara Z wrote: Yes, obviously, but if this is a valid operator what is the syntax for using it - either in general or with my example, as everything I have tried has not worked...?? I tried the following and it does not work, i.e., does not return "Test Positive" or "Test Negative" . { IF { = OR ({MERGEFIELD "County"}="Hillsborough", {MERGEFIELD "County"}="Pinellas")} =1 "Test Positive" "Test Negative"} "smcash" wrote in message ... I'm new to this stuff, but as far as I can tell the operator is simply: Or -smcash "Lara Z" wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#10
|
|||
|
|||
smcash,
The problem with that approach is that it breaks down with the 3rd county { IF { = OR ({ Compare "{ County }" = "Hillsborough" }, { Compare "{ County }" = "Pinellas" }, { Compare "{ County }" = "Lake" })} = 1 "Test Sat""Test Fail" } will generate "Test Fail" The OR only handles two conditions and you have to keep nesting them which I find very even more confusing to keeping track of the structure than using the nested IF field: { IF { = OR ({ Compare "{ County }" = "Pinellas" }, OR ({ Compare "{ County }" = "Hillsborough" }, OR ({ Compare "{ County }" = "Lake" }, OR ({ Compare "{ County }" = "Orange" }, OR ({ Compare "{ County }" = "Brevard" }, OR ({ Compare "{ County }" = "Indian River" }, { Compare "{ County }" = "Volusia" }))))))} = 1 "Test Sat""Test Fail" } -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. smcash wrote: Oops, I mistyped OR. Where I wrote OF, it is obviously supposed to be OR. |
#11
|
|||
|
|||
Yes, this unwieldy:
{ IF { = OR(OR(OR(OR(OR(OR({ Compare "{ County }" = "Pinellas" }, { Compare "{ County }" = "Hillsborough" }), { Compare "{ County }" = "Lake" }), { Compare "{ County }" = "Orange" }), { Compare "{ County }" = "Brevard" }), { Compare "{ County }" = "Indian River" }), { Compare "{ County }" = "Volusia" })} = 1 "Test Sat""Test Fail" } :-) -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Peter Jamieson wrote: try { IF { =or({ COMPARE "{ MERGEFIELD "County" }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD "County" }" = "Pinellas" }) } = 1 "Test positive" "Test Negative" } if you ave a thrid comparison, you will need a second OR, e.g. { IF { =or(or({ COMPARE "{ MERGEFIELD "County" }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD "County" }" = "Pinellas" }) , { COMPARE "{ MERGEFIELD "County" }" = "County3" }) } = 1 "Test positive" "Test Negative" } Unwieldy, isn't it? Just a suggestion, but if you are inserting form a separate file you might be better off using the result of the { =} field as part of the file name, e.g. if you have Counties0.doc and Counties1.doc you might use { INCLUDETEXT "c:\\mydocs\\Counties{{ =or(or({ COMPARE "{ MERGEFIELD "County" }" = "Hillsborough" }, { COMPARE "{ MERGEFIELD "County" }" = "Pinellas" }) , { COMPARE "{ MERGEFIELD "County" }" = "County3" }) }.doc" or you can use 2 bookmark names within a single file to achive something similar. Peter Jamieosn "Lara Z" wrote in message ... Yes, obviously, but if this is a valid operator what is the syntax for using it - either in general or with my example, as everything I have tried has not worked...?? I tried the following and it does not work, i.e., does not return "Test Positive" or "Test Negative" . { IF { = OR ({MERGEFIELD "County"}="Hillsborough", {MERGEFIELD "County"}="Pinellas")} =1 "Test Positive" "Test Negative"} "smcash" wrote in message ... I'm new to this stuff, but as far as I can tell the operator is simply: Or -smcash "Lara Z" wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#12
|
|||
|
|||
Lara,
I found some material that I had squirreled away on Word math fields. A bright fellow that goes by Macropod shows us a relatively simple process: { If { =({ IF { County } = "Hillsborough""1""0" }+{ IF { County } = "Pineallas""1" "0"}+{ IF { County } = "Lake""1""0" }+{ IF { County } = "Orange""1""0" }+{ IF { County } = "Brevard""1""0" }+{ IF { County } = "Indian River""1""0" }+{ IF { County } = "Volusia""1""0" }+{ IF { County } = "Oceola""1""0" }) } 0 "Test Sat""Test Unsat } Basically you just set up 8 condition equal 0 or 1 and add then up. One and only one can be 1 and if any one is 1 then the condition {=(1)} 0 is met and the true result displayed. As mentioned earlier, you should replace "Test Sat" with an IncludeText field or AutoText field. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Lara Z wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#13
|
|||
|
|||
Hi Greg,
It's currently starred on the Woody's Lounge (www.wopr.com). The full path is: http://www.wopr.com/cgi-bin/w3t/show...?Number=365442 (url all one line) Cheers "Greg" wrote in message oups.com... Macropod, Yes I knewn that, I should have mentioned it to the OP. Since I don't have a merge field handy I often just substitute a REF field. I looked for half an hour last night for the file I have on your math fields. I knew there was a relatively easy way to do this. Thanks |
#14
|
|||
|
|||
You can probably simplify that using COMPARE via e.g.
{ IF { =({ COMPARE { County } = "Hillsborough" }+{ COMPARE { County } = "Pineallas" }+{ COMPARE { County } = "Lake" }+{ COMPARE { County } = "Orange""1""0" }+{ COMPARE { County } = "Brevard" }+{ COMPARE { County } = "Indian River" }+{ COMPARE { County } = "Volusia" }+{ COMPARE { County } = "Oceola" }) } 0 "Test Sat" "Test Unsat" } Peter Jamieson "Greg Maxey" wrote in message ... Lara, I found some material that I had squirreled away on Word math fields. A bright fellow that goes by Macropod shows us a relatively simple process: { If { =({ IF { County } = "Hillsborough""1""0" }+{ IF { County } = "Pineallas""1" "0"}+{ IF { County } = "Lake""1""0" }+{ IF { County } = "Orange""1""0" }+{ IF { County } = "Brevard""1""0" }+{ IF { County } = "Indian River""1""0" }+{ IF { County } = "Volusia""1""0" }+{ IF { County } = "Oceola""1""0" }) } 0 "Test Sat""Test Unsat } Basically you just set up 8 condition equal 0 or 1 and add then up. One and only one can be 1 and if any one is 1 then the condition {=(1)} 0 is met and the true result displayed. As mentioned earlier, you should replace "Test Sat" with an IncludeText field or AutoText field. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Lara Z wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#15
|
|||
|
|||
Indeed:-)
I certainly hope Lara Z has some ideas to go on now! Peter J. "macropod" wrote in message ... Hi Peter & Greg, In either case, you're going to need to set the 'County' value via the mailmerge. Unless you're planning to do this via a SET field that I haven't seen explained (eg {SET County {MAILMERGE CountyName}}), you'd both need to use {MAILMERGE County} instead of {County}. Cheers "Peter Jamieson" wrote in message ... You can probably simplify that using COMPARE via e.g. { IF { =({ COMPARE { County } = "Hillsborough" }+{ COMPARE { County } = "Pineallas" }+{ COMPARE { County } = "Lake" }+{ COMPARE { County } = "Orange""1""0" }+{ COMPARE { County } = "Brevard" }+{ COMPARE { County } = "Indian River" }+{ COMPARE { County } = "Volusia" }+{ COMPARE { County } = "Oceola" }) } 0 "Test Sat" "Test Unsat" } Peter Jamieson "Greg Maxey" wrote in message ... Lara, I found some material that I had squirreled away on Word math fields. A bright fellow that goes by Macropod shows us a relatively simple process: { If { =({ IF { County } = "Hillsborough""1""0" }+{ IF { County } = "Pineallas""1" "0"}+{ IF { County } = "Lake""1""0" }+{ IF { County } = "Orange""1""0" }+{ IF { County } = "Brevard""1""0" }+{ IF { County } = "Indian River""1""0" }+{ IF { County } = "Volusia""1""0" }+{ IF { County } = "Oceola""1""0" }) } 0 "Test Sat""Test Unsat } Basically you just set up 8 condition equal 0 or 1 and add then up. One and only one can be 1 and if any one is 1 then the condition {=(1)} 0 is met and the true result displayed. As mentioned earlier, you should replace "Test Sat" with an IncludeText field or AutoText field. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Lara Z wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
#16
|
|||
|
|||
Macropod,
Yes I knewn that, I should have mentioned it to the OP. Since I don't have a merge field handy I often just substitute a REF field. I looked for half an hour last night for the file I have on your math fields. I knew there was a relatively easy way to do this. Thanks |
#17
|
|||
|
|||
Oh my! I stepped away for a couple of days and came back to lots of great
responses. I am trying macropod's and Maxey's use of a numerical test, coupled with an INCLUDETEXT command when it returns 1. Works great. Thanks for all the teriffic dialog/feedback. "Peter Jamieson" wrote in message ... Indeed:-) I certainly hope Lara Z has some ideas to go on now! Peter J. "macropod" wrote in message ... Hi Peter & Greg, In either case, you're going to need to set the 'County' value via the mailmerge. Unless you're planning to do this via a SET field that I haven't seen explained (eg {SET County {MAILMERGE CountyName}}), you'd both need to use {MAILMERGE County} instead of {County}. Cheers "Peter Jamieson" wrote in message ... You can probably simplify that using COMPARE via e.g. { IF { =({ COMPARE { County } = "Hillsborough" }+{ COMPARE { County } = "Pineallas" }+{ COMPARE { County } = "Lake" }+{ COMPARE { County } = "Orange""1""0" }+{ COMPARE { County } = "Brevard" }+{ COMPARE { County } = "Indian River" }+{ COMPARE { County } = "Volusia" }+{ COMPARE { County } = "Oceola" }) } 0 "Test Sat" "Test Unsat" } Peter Jamieson "Greg Maxey" wrote in message ... Lara, I found some material that I had squirreled away on Word math fields. A bright fellow that goes by Macropod shows us a relatively simple process: { If { =({ IF { County } = "Hillsborough""1""0" }+{ IF { County } = "Pineallas""1" "0"}+{ IF { County } = "Lake""1""0" }+{ IF { County } = "Orange""1""0" }+{ IF { County } = "Brevard""1""0" }+{ IF { County } = "Indian River""1""0" }+{ IF { County } = "Volusia""1""0" }+{ IF { County } = "Oceola""1""0" }) } 0 "Test Sat""Test Unsat } Basically you just set up 8 condition equal 0 or 1 and add then up. One and only one can be 1 and if any one is 1 then the condition {=(1)} 0 is met and the true result displayed. As mentioned earlier, you should replace "Test Sat" with an IncludeText field or AutoText field. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Lara Z wrote: I am trying to code a merge document that will insert an additional two-page document if the 'COUNTY' field is one of eight counties. The additional document is the same for all eight counties. In WordPerfect this could be done simply with the SWITCH/ENDSWITCH construct. I know there is no equivalent in Word, but is there any easier way to do this than doing eight back-to-back IF statements with the same (redundant) two pages of text inserted in each "then" part of the IF statement? Is there an OR operator in Word that might help accomplish this? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Enter data in 1 text form field & have multiple locations fill | Microsoft Word Help | |||
Zip Field Jumps Out Of Place | Mailmerge | |||
Make merged field bold if merged field > 3 | Mailmerge | |||
How do I use the PRINT field code to ... | Microsoft Word Help | |||
Text Form Field Ref in Footer Won't Update on Screen | Microsoft Word Help |