4

I have a field code with a strange behavior. When I put the code,

{ IF NUMPAGES=NUMPAGES "A" "B" }

I get A as expected however, when I reverse this, ie

{ IF NUMPAGES<>NUMPAGES "A" "B" }

I still get A.

Why is this happening?

user1543042
  • 259
  • 1
  • 5
  • 13

1 Answers1

1

You need to say

{ IF NUMPAGES <> NUMPAGES "A" "B" }

Word Help: Field codes: IF field says,

Operator

Comparison operator.  Insert a space before and after the operator.
                        ⋮

I can't find this documented anywhere, but it looks like Word is interpreting your code as

IF "NUMPAGES<>NUMPAGES" ≠ "" ... 
  • 1
    Just as a followup, it needs to have braces around `NUMPAGES`, ie `{ IF { NUMPAGES } <> { NUMPAGES } "A" "B" }` – user1543042 Jun 22 '15 at 12:55