An Alternative to Conditional Text

Subject: An Alternative to Conditional Text
From: Dan Emory <danemory -at- primenet -dot- com>
To: "FrameSGML List" <FrameSGML -at- onelist -dot- com>, "Free Framers" <framers -at- omsys -dot- com>, "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>, "Katherine Mooney" <mooneyk -at- nosc -dot- mil>
Date: Tue, 13 Jun 2000 04:05:36 -0700

BACKGROUND
The conditional text feature of FrameMaker provides a way to create multiple versions of a document from a single FM file. Above a relatively simple level of complexity, however, conditional text becomes an unmanageable nightmare.

As I discussed in a recent post, Frame's text inset capability, combined with conditional text and variables, offers a solution for some special cases where modules of information are mixed and matched in different ways to produce different versions. A library of text insets (each of which may contain conditional text and variables) is created. Many individual text insets can be created in a single FM file by placing each text inset in a uniquely named text flow. Then, a "skeleton" FM document is created for each version, into which the applicable text insets are imported by reference in the required sequence. Variables in the imported text insets take on the values established in the skeleton document. The show/hide settings in the skeleton determine which conditional information in the text insets is visible. But this solution also has its limitations and special problems.

UNIMERGE OFFERS A MORE POWERFUL AND FLEXIBLE SOLUTION
This product, from Refined Reports (mmark -at- progress -dot- com) adds a database publishing capability to FrameMaker. I have no financial or other interest in this product, other than the fact that I've been successfully using it in my practice for about 7 years. UniMerge runs on Windows and Sun Solaris platforms. The retail price on Windows platforms is about $695 on Windows, $995 on Sun. It is not an FM plug-in. Instead, it executes from the DOS or Unix command line. The product comes with an excellent (printed) user manual (about 125 pages). UniMerge has a simple but powerful command language that is well-documented in the manual.

How UniMerge and FrameMaker Work Together:
UniMerge takes as input a FrameMaker template file (saved in MIF format) and a database extract (e.g., comma-delimited ASCII records) The template contains a mixture of static text, UniMerge commands, and fieldnames. A DOS batch file or Unix script specifies the template filename and the filename of the ASCII data extract, as well as other optional parameters. Execution causes UniMerge to merge the template with the data extract to produce a FrameMaker MIF output file. Execution is very fast. In one case, I was able to produce, from a 2-page FrameMaker template file, a 1000-page FrameMaker file in about 2 minutes. At merge time, all fieldnames in the template are replaced in the merged output by their field values in the individual records.

Using UniMerge To Produce Multiple Versions of a Document:
Although UniMerge is used primarily to produce fully formatted, ready-to-print catalogs and directories, it can also be used for the purpose being described here. I have, for example, produced customized benefit books for each employee from a human resources database extract. The same approach can be used to produce different versions of a document from a template that contains all versions. In this case it usually wouldn't be necessary to create a database to produce the data extract.

A Very Simple Data Extract:
Let's say that you have four versions, named A, B, C, and D. The ASCII data extract would contain 4 records, each having a single field named Version. Thus, you'd simply create an ASCII data file with the following lines, where each line (in this case) constitutes a record:

Version:A
Version:B
Version:C
Version:D
When you execute UniMerge, four MIF output files are produced, one for each of the four document versions.

Obviously, each record in the data extract could contain more than 1 field if other variables besides Version are needed.
==================================================================
A Simple Example, Using Conditional Expressions to Perform the Same Function as Conditional Text:

Here is a very simple FrameMaker template for producing 4 different versions of a document from the simple data extract shown above.
Conditional expressions are used to produce the same effect as showing/hiding FrameMaker conditional text:

Static (i.e., invariant) text, graphics, tables, etc. that are common to all versions

IF (Version = "A")
Any combination of adjacent text, graphics, tables, etc. that are only present in Version A.
ELSE IF (Version = "B") OR (Version = "C")
Any combination of adjacent text, graphics, tables, etc. that are only present in Versions B and C.
END //notice that nothing is produced here for version D.

More static text, graphics, tables, etc. that are common to all versions

IF (Version = "A") OR (Version = "C")
Any combination of adjacent text, graphics, tables, etc. that are only present in Versions A and C
END //Notice that nothing is produced here for versions B and D.

IF (Version = "A") OR (Version = "B") OR (Version = "C")
Static lead-in text ^[IF (Version = "A")]blah blah ^[ELSE IF (Version = "B) OR (Version = "C)blah, blah^[END] more static text.
END //Notice again that nothing is produced for version D.

The last conditional expression above is in the "in-line" form that allows it to be used anywhere within a text paragraph.

If an expression is true, all contents up to the next ELSE, ELSE IF, or END are merged.

Conditional expressions can use any combination of boolean AND and OR operators, and they can be nested to any depth

Operators inside the expressions, in addition to =, can include > (greater than), < (less than), >= (greater than or equal), <= (less than or equal) and != (not equal to).
=======================================================
UniMerge can also define variables that may be inserted into text.

For example:
IF (Version = "A")
SET varname1 "ABC"
SET varname2 "DEF"
ELSE
SET varname1 "UVW"
SET varname2 "XYZ"
END //the two variables have one set of values for version A, and another set of values for versions B, C, and D

Now, these variables can be inserted anywhere in the text, as shown below:

Now is the time ^varname1 for all good men to ^varname2 come to the aid of the countrymen.

At merge time, UniMerge replaces ^varname1 and ^varname2 with their values.
==========================================================
UniMerge can also import into the flow tagged text "fragments" contained in external FrameMaker files.

For example:

INCLUDE "fragfilename" FRAGMENT "^Version"
Where fragfilename is the name of a MIF file containing tagged text fragments, and ^Version is resolved at merge time to the value of the Version field.

UniMerge looks in the specified fragment file for a fragment having a tagname corresponding to the value of ^Version, extracts that fragment from the file, and replaces the INCLUDE command line with the fragment. Fragments can include fieldnames within the text, which are replaced at merge time with the corresponding field values. INCLUDE commands can use the in-line form so that fragments can be inserted within a paragraph that contains a combination of static text and fragments.
============================================================
Using the UniMerge capabilities described above (there are a number of others which I have not mentioned), and in particular conditional expressions, very complicated conditional text relationships can be set up.

For those interested in more details about using UniMerge with FrameMaker, I have a 5-page PDF paper that provides a good overview.








====================
| Nullius in Verba |
====================
Dan Emory, Dan Emory & Associates
FrameMaker/FrameMaker+SGML Document Design & Database Publishing
Voice/Fax: 949-722-8971 E-Mail: danemory -at- primenet -dot- com
10044 Adams Ave. #208, Huntington Beach, CA 92646
---Subscribe to the "Free Framers" list by sending a message to
majordomo -at- omsys -dot- com with "subscribe framers" (no quotes) in the body.






Previous by Author: Re: Structure vs Substance?
Next by Author: Re: Structure vs Substance?
Previous by Thread: Fwd: Help in Planning
Next by Thread: Nonprofit Organizations


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


Sponsored Ads