[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

New Beta Version of UniMerge



I've received a new Beta test version (Beta 2.0c) of UniMerge from Michael
Mark at Refined Reports--mmark@bedford.progress.COM (Michael Mark). This new
version has some features which, when combined with the existing features,
makes UniMerge even more powerful as a database publishing tool when used
with FrameMaker.

BTW, I derive no financial benefit by promoting Refined Reports or UniMerge,
other than the considerable income I've gotten by successfully using it to
develop a wide variety of complex applications for my clients, as well as,
in many cases, actually producing the complete book (several with 1000+
pages) as print-ready Acrobat files for delivery to the printer.

In a fairly complex directory publishing application that contains a
who's-who type biography for each member of a large association, listed by
state/city or country/city, UniMerge merges the database records and outputs
them (fully formatted) to a MIF file at a rate of 5000 records (equivalent
to about 150 printed pages) per minute. UniMerge also embeds in each output
record an index marker for generating an alphabetical index of the members
that contains the name, his/her location (city/state or city/country), and
the page number where the biographical information can be found.

Here are the new features in UniMerge Beta 2.0c, all of which I've tested:

1. STRLEN - This command allows you to find out the number of characters in
a data field. The command syntax is:

        STRLEN(fieldname)
It returns a number (the number of characters in the field)

2. INSTR - This command allows you to inspect a string-type field for the
first occurrence of a specified substring. The command syntax is:

        INSTR(fieldname,"substring")
where substring is the substring you are searching for.
It returns "0" if the string is not found, or, if it is found, it returns
the character position in the string of the first character of the substring.

3. SUBSTR - This command allows you to extract a substring from within a field.
The command syntax is:

        SUBSTR(fieldname,strt_pos,length)

where strt_pos is the number within the string of the first character to be
extracted, and length is the number of characters to be extracted. It
returns the extracted characters.

You can also use the SUBSTR command to put the extracted substring in the
merged output:

^(SUBSTR(fieldname,strt_pos,length))

You can also use any of these three new commands within a SET command to
define and semi-persistently store a value in a user-defined variable, as
shown in the examples below.
 
EXAMPLE 1:
I tested to see if I could use STRLEN to get the lengths of two fields
(addr1 and addr2), then add those two lengths together, determine whether
the sum is less than the line limit(45 characters in this example), and, if
so, the two fields are concatenated on the same line; otherwise, the two
fields appear on separate lines:

SET addr1len STRLEN(addr1)//get & store in variable addrlen1 the addr1 length
SET addr2len STRLEN(addr2)//get & store in variable addrlen2 the addr2 length 
IF ((addr1len + addr2len) < 45)//Check if sum of the 2 lengths is < 45.
//If true, concatenate the two address fields on the same line:
        ^addr1, ^addr2
ELSE//don't concatenate them
        ^addr1
        ^addr2
END

EXAMPLE 2:
The SUBSTR command lets us create index-type alphabetical headers for names
in a directory:

SET old_first_char ""//Initialize this variable to contain nothing
SET first_char SUBSTR(name,1,1)//truncate field name to its 1st character.
IF (first_char != old_first_char)//compare value of first_char to the
//value in old_first_character to see if there is a letter transition
        SET old_first_char first_char//store new letter in this variable
//Now, output variable first_char to produce the new alphabetical header

        ^First_char
END
//Now, output the first name to appear under the new alphabetical header
        ^name

EXAMPLE 3:
Lets say a field named "gibberish" sometimes contains the 5-character string
" foo ", and, in these cases, I want to edit the string so as to replace "
foo " with the 8-character string " foobar ". Note that the string cannot
begin with 
" foo " because the first character in this substring is a space, and
leading spaces are stripped out by UniMerge if the string is not quoted.
Consequently, when " foo " is found, the gibberish field must always be
chopped into two pieces--part 1 before " foo ", and part 2 after " foo ",
with " foobar " inserted between the two pieces. To accomplish this, I use
all three of the new commands:

SET length STRLEN(gibberish)//Store in the length variable the length of the
gibberish field
SET check INSTR(gibberish," foo ")//Set variable check to indicate whether
" foo " is present in gibberish field, and if it is, the value of the
variable indicates the starting position of substring " foo " within the string.
IF (check != "0")//If not 0, a " foo " sub-string is present
        SET part1_len (check - 1)//calculate length of part 1
        SET part2_st (check + 5)//calculate start position of part 2
        SET part2_len (length - part2_st + 1)//calculate length of part 2 
        SET part1 SUBSTR(gibberish,1,part1_len)//Extract part 1
        SET part2 SUBSTR(gibberish,part2_st,part2_len)//Extract part 2
        //Put the gibberish string back together with, " foo " replaced by
          " foobar ":

        ^part1 foobar ^part2

        ELSE//string does not contain " foo " therefore it's  not edited.

        ^gibberish
END

It works! It's sort of like doing gene splicing.

4. In addition to the three new commands described above, the new beta also
allows you to include special characters (i.e., those above ANSI 126) in the
database extract. There are two ways of doing this:

        a. By specifying the special character's hex code, in the form \xyy
           where \x indicates that a 2-digit hexadecimal number (yy) follows.
           The hex code must be the code point of the special character in
           the FrameMaker (MAC) character set.

        b. By specifying the special character with the code point in the ANSI
           Windows character set. UniMerge converts is to the corresponding code
           point in the FrameMaker (MAC) character set. I have not tested to
           see if all characters above ANSI 126 are properly converted. It
           appears that, at a minimum, accented characters are properly 
           converted.


Dan Emory
Dan Emory & Associates
FrameMaker/FrameMaker+SGML Document Design
and Database Publishing Specialists

Voice/Fax: 949-722-8971
E-Mail: danemory@primenet.com
10044 Adams Ave. #208
Huntington Beach, CA 92646


** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **