conditionals and variables in Word

Subject: conditionals and variables in Word
From: dmbrown -at- brown-inc -dot- com
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Tue, 10 Sep 2002 10:29:43 -0700


I received this question off-list:
>
> ...We do a lot of private labeling, and are just starting
> to use mail merge as a database publisher. What are you
> using for conditional text?

I thought others might find the following information useful. (If you don't use Word, skip this message; and please don't bother telling me how much easier this might be in *your* favorite tool.)

The company I worked for in '90 created software that ran on either DOS or OS/2 to control hardware that fit either the VMEbus or VXIbus specification. I used variables and conditional text to produce four different user's guides from a single Word file.

At the top of the file, one variable was set to either "DOS" or "OS/2", and another was set to either "VMEbus" or "VXIbus", as in this example:

{ SET os "DOS" }{ SET bus "VMEbus" }

Throughout the book were sentences like this:

Thank you for purchasing WhatsitPro { REF "os" \* MERGEFORMAT } for
{ REF "bus" \* MERGEFORMAT }!

and...

{ REF bus \* MERGEFORMAT } modules come in { IF bus = "VMEbus" "2" "4"
\* MERGEFORMAT } sizes.

(Hey, they're just examples--it was twelve years ago.)

Sentences like this were a little more complicated:

You just { IF os = "DOS" "type simple commands" "use your mouse to
select menu actions" \* MERGEFORMAT } that indicate what you want
WhatsitPro { REF "os" \* MERGEFORMAT } for { REF "bus" \* MERGEFORMAT }
to do.

You could even "nest" conditionals like this:

{ IF os = "DOS" { IF bus = "VMEbus" "DOS for VMEbus" "DOS for VXIbus" }
{ IF bus = "VMEbus" "OS/2 for VMEbus" "OS/2 for VXIbus" } \* MERGEFORMAT }

(Of course, you'd have meaningful information in the conditional text strings; I'm just showing how they'd be evaluated, based on the two variables.)

It was a little harder to write the text with these variables replacing actual words; but it was the only way one person (I) could create all four versions of the two books I set up this way, given the time constraints I was under.

I'd do it again if faced with the same circumstances.

Again, two simple SET fields at the start of the book controlled it all:

{ SET os "DOS" }{ SET bus "VMEbus" }{ SET booktitle "WhatsitPro { REF
"os" \* MERGEFORMAT } for { REF "bus" \* MERGEFORMAT } User's Guide" }

That third SET field gave me a variable called "booktitle" that I could use in footers and such, most of which were set up with the SameAsPrevious flag set for the headers and footers. That made sure the right product name was propagated throughout the book, no matter what version I was creating.

The only limitation to this method (at least, back in Word 2.0) was that the conditional text couldn't contain paragraph end markers. That is, if it did, they wouldn't retain paragraph formatting and style info. (Character formatting was fine.)

It worked for me because the different versions of the book were very similar in structure: I could easily limit differences to text shorter than paragraph-length, or create parallel paragraphs to hold series of differences.

More recently, I used the INCLUDETEXT field to pull a larger chunk of text into a book that either did or didn't need it, based on a variable that described the software version. The "included" text was in a separate file, and it comprised an entire section with multiple levels of headings, tables, figures, ...the works.

{ IF model = "Plus" { INCLUDETEXT "\\docs\\usersgd\\plus_export.doc"
\* MERGEFORMAT } "" }

This means that, if you have the Plus version, you read about some additional export-related capabilities that are described in the plus_export.doc file; otherwise, you see nothing (the empty quotes).

The only limitation I found was that index entries (XE fields) in the included file sometimes showed the page number where the INCLUDETEXT field appeared, rather than the page number where the XE fields actually appeared when the included text was expanded in place.

It worked for me because some of the included chunks were small enough to fit on a single page, and others had index entries only on the page where the included text started (which is where the INCLUDETEXT field appears, of course).

In case you're not familiar with it, the "\* MERGEFORMAT" option tells Word to remember how you've formatted this particular instance of the REF'ed (subsituted) text. Without it, Word will format the substituted text as it appears in the original SET field, which typically isn't appropriate. MERGEFORMAT lets you format the REF'ed text just once "in situ" and then forget about it.

How might you use this technique?

Just use SET fields to define "companyname", "productname", "version", and "booktitle" variables. Then write the text using the variables instead of hard-coding the names. You may find you need to set up full and abbreviated versions of the product name and maybe the company name, too. For example, Marketing said it was OK to call "WhatsitPro DOS for VMEbus" just "WhatsitPro" in many contexts.

It takes a little up-front analysis and a bit of practice (training yourself not to type the actual names in the text!), but this is a great way to set up a book for "private labeling."

I hope this information helps. Good luck!

--David

========================================================================

N O W A V A I L A B L E ! http://www.html-indexer.com/

HTML Indexer 4 is still the easiest way to create and maintain indexes
for web sites, intranets, HTML Help, JavaHelp, and other HTML documents.

Now with fully integrated cross-references, target frames and windows,
multiple-file output, "one-step accept" of default entries, and more!

 


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Absolutely FREE! FrameMaker/Win 6 & 7 Express Customization (v3):
Quick-access buttons & keys to common functions, char tag/font drop-down
lists, charset browser, QRef guides & much more: http://www.microtype.com/2

Check out the new release of RoboDemo, our easy-to-use tutorial software.
Plus, buy RoboHelp Office in August and save $100 with our mail-in rebate.
Get details and download free trial versions at http://www.ehelp.com/techwr-l

---
You are currently subscribed to techwr-l as:
archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit
http://www.raycomm.com/techwhirl/ for more resources and info.



Previous by Author: Re: corrupt word file
Next by Author: Re: Template update help
Previous by Thread: Re: Seeking Folio users
Next by Thread: Importing Word equations to page layout


What this post helpful? Share it with friends and colleagues:


Sponsored Ads