View Single Post
 
Old 08-23-2018, 12:33 PM
Cosmo Cosmo is offline Windows Vista Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default Field Code: Show a value only if bookmark is not empty

I rarely have to delve into the pain that is MS Word Field Codes, and whenever I do, I end up pulling my hair out.

I need to have show a value ONLY if a bookmark is NOT empty.

I tried using a COMPARE, but it only seems to work if I specify the EXACT value (e.g. "Test"). If I compare it to an empty string (""), it doesn't work. The following code:

{COMPARE{REF TestBookmark} = "Test"}

gives me a result of 1 if 'TestBookmark' does equal "Test". But if I try to use the following:

{COMPARE{REF TestBookmark} = ""}

I always get a 0 result.

Is there any way to tell if a Bookmark is empty?

What I'm looking for is something like this:

{IF{={COMPARE{REF TestBookmark} = ""} > 0} "Bookmark Is Empty" "Bookmark Is NOT Empty"}
Reply With Quote