Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Word 2007 IF merge field double quotes
Old 04-07-2009, 10:39 PM Word 2007 IF merge field double quotes
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I am writing a fairly complex mail merge document which has some conditional expressions. In the THEN and ELSE areas, I am trying to include a double quote. I have figured out that if I put in a backslash before the double quote that the IF is properly executed, but the backslash remains. Is there a way to correct that?

For example,

Code:
{IF {MERGEFIELD field_name} = "Yes" "My \"Yes\" answer." "My \"No\" answer."}
Will display either: My \"Yes\" answer. or My \"No\" answer. and I can't get the backslashes to go away.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
 
Register now for full access!
Old 04-08-2009, 11:12 PM Re: Word 2007 IF merge field double quotes
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
I don't know about the language you're coding in, but I think that if you put the whole thing in single quotes instead of double quotes, and got rid of the backslashes, it would work. Like:
Code:
{IF {MERGEFIELD field_name} = 'Yes' 'My "Yes" answer.' 'My "No" answer.'}
I'm not sure, but it it functions properly in JavaScript and PHP...

- Steve
__________________
if($stevej == "helpful") { $talkupation += $user_power; }
stevej is offline
Reply With Quote
View Public Profile
 
Old 04-08-2009, 11:36 PM Re: Word 2007 IF merge field double quotes
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I was going to say the same thing, but then I thought to myself, "Jeremy has like 3 times more programming experience than me, I think he probably thought of that."

What language ARE you using dude?
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 04-09-2009, 01:35 AM Re: Word 2007 IF merge field double quotes
stevej's Avatar
Professional Multitasker

Posts: 996
Location: Not positive
Trades: 0
Hah! that's exactly what I thought as well, wayfarer. But oh well, I thought I'd post it anyway.

I'll second wayfarer's query: What language ARE you using dude?
__________________
if($stevej == "helpful") { $talkupation += $user_power; }
stevej is offline
Reply With Quote
View Public Profile
 
Old 04-09-2009, 02:27 AM Re: Word 2007 IF merge field double quotes
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
Like they said, I don't know what language this is. But maybe there is a way you could use ascii values and then encode it before output. That might be a bad way but its the best I can think of right now.

Just thought of something else. Convert the string to a character array and output each character. Even as I'm think of it it sounds like a completely wrong an terrible way of doing this, but its the best I got

Someone should stop me before I start writing assembly code to break down the string and output characters that arn't slashes.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 04-09-2009 at 02:33 AM..
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 04-09-2009, 01:47 PM Re: Word 2007 IF merge field double quotes
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Thanks for the tips! And, the reminder about the alternate string syntax. You're right, I should have thought of that. Just tested, though, and it didn't work. The "language" is MS Word 2007's Mail Merge IF conditional.

I've tested doubling the quotes, the escape trick, switching between "smart" quotes and regular quotes, and -- now -- switching the quote style (which gave problems with apostrophes too).

What I've ultimately ended up using as a solution is having a macro executed on mail merge to search and replace \" with ". Not ideal, but it does work.

One would think, however, that there'd be a correct way to escape the quotes for display.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Word 2007 IF merge field double quotes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16792 seconds with 12 queries