View Single Post
  #1  
Old November 8th, 2004, 03:39 PM
Monika Krug
external usenet poster
 
Posts: n/a
Default "AND" (compound conditions)

(version: Word 2003)

I hope someone can help me with this problem, it is
driving me crazy:

I have these fields in my document:
(The /* comments */ are added for clarity here.)

{ IF { MERGEFIELD "associations" } = "070" { SET v070
true } { SET v070 false } } { NEXTIF v070 } /* as the
first record has associations=070, this results in v070
being set to true and Word going to the next data record */

v070: { v070 } /* shows v070 for debugging - true as
expected */

less: { IF { MERGEFIELD "Index_070" } {
MERGEFIELD "Total_070" } true false} /* this should be
true, because 1 is less than 3 */

{ SET more { = AND (v070; { IF { MERGEFIELD "Index_070" }
{ MERGEFIELD "Total_070" } true false}) } } /* here is
the trouble */

mo { more } /* this should be 1, as true and true
results in true - but it is not working */

{ IF v070 "{ MERGEFIELD Index_070 }/{ MERGEFIELD
Total_070 }"} /* shows 1/3 as expected */

The relevant columns of the first four rows of data a
associations; Total_070; Index_070;
070; ; ;
; 3; 1;
; 3; 2;
; 3; 3;
(I.e. for the first record associations=070 and the total
and index are empty, for the other records associations is
empty, total is always 3 and index is counted from 1 to 3.
The part I show above only uses the first two records.)

The shown result is:

v070: true
less: true
mo 0
1/3

Why is the result of the AND field 0, even though both
parts are true?! I don't get it. What is wrong? Am I using
AND incorrectly?

I have tested { = AND (true; 1) } and different
combinations of true, false, 0, and 1 in the brackets
after AND - the result was always as expected, e.g. = AND
(true; 1) yields 1.

Any ideas?


Different, not so important question: I think { = AND
(v070; { MERGEFIELD "Index_070" } {
MERGEFIELD "Total_070" } ) } should be working, too,
instead of { = AND (v070; { IF { MERGEFIELD "Index_070" }
{ MERGEFIELD "Total_070" } true false}) } . Any ideas
why it does not work at all? I get a "!Syntax Error, ".


I have another weird problem with the same mail merge
document:

1. When I open it and preview for the first time (with the
first data record, or actually with the first two as I use
nextif), the result is true, true, 0, 1/3 as shown above,
so as expected except for the weird 0.

2. When I highlight all and press F9, suddenly true,
false, 0, / are displayed. How is that possible?!

3. When I click to preview the next record and back to #1,
it now shows true, true, 0, 1/3 again. (At least I have
found this workaround finally, so I don't have to close
and reopen my document all the time.)

I first thought, maybe Word now (after the second step,
i.e. after pressing F9) is at the second data record and
evaluating that one - but in that case, v070 should be
false (which remains true) and the "less" statement should
still be true, as 23, and not without any reason become
false.

Help particularly with the first problem would be greatly
appreciated.

Regards,
Monika.