Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word - Can't build string as result of condition test on variable

Status
Not open for further replies.

phessup

Programmer
May 8, 2002
15
US
Here's the problem code in Microsoft Word (2000) template:

{IF {DOCPROPERTY&quot;Custom_val&quot; } < &quot; &quot; &quot;None&quot; DOCPROPERTY&quot;Custom_val&quot;}++&quot; percent&quot;}

Here's what I'm trying to do:

If Custom_val is empty, return &quot;None&quot; otherwise return the value of Custom_val appended with the word &quot;percent&quot;

Here's what I've tried:

I've tried &quot;+&quot;, &quot;-&quot;, &quot;&&quot;, &quot;_&quot;, &quot;&&&quot;, and &quot;++&quot; so far to concatenate the elements 'Custom_val' and &quot;percent&quot; without success. Word will not recognize any element beyond the first element of the attempted concatenation. This is not a mail merge which would be able to use the built in &quot;IF...Then...Else&quot; function of &quot;add a field&quot;.

Can someone please tell me how to do this?

Thanks
 
Whilst no expert in Word, it would appear you may be missing a bracket.

bandit600
 
You have a sharp eye, but it was just a recopying typo. The original code was built with drop boxes which automatically includes the &quot;{}&quot; as placeholders for the begin/end element markers. I had to manually retype the &quot;{}&quot; braces in order for the code to appear in this forum. Must have missed one. The code actually reads as follows:

{IF {DOCPROPERTY&quot;Custom_val&quot; } < &quot; &quot; &quot;None&quot; {DOCPROPERTY&quot;Custom_val&quot;}++&quot; percent&quot;}

Hope you can help me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top