Top Navigational Bar

Work Around For Decimal Places In Macros And
DocumentID: 653243
Revision Date: 29-Feb-96 8:29:21 PM

The information in this document applies to:
WordPerfect® 5.1 for DOS

Problem

Solutions: In Memo WP51_2350, it is stated that WP 5.1 does not currently support decimal places in merge and macros. The following merge primary file is a work around for a situation where a secondary file's first field contains a number between 1 and 4, and that number may contain a decimal value such as 2.34 or 3.9. The merge uses the {IF} statement and tests the value of the first whole number. For example, the 2 in 2.34 is evaluated to see if it is between 1 and 4. The {MID} command is used to do the evaluating, as it allows a focus on a number or numbers within a decimal numeral.


The following merge primary file is designed to work with numbers between 1 and 9.9; however, if numbers up to 10 or greater will be evaluated, the variables that are a part of the {MID} command would need to be adjusted to allow for numbers less than 9.999 to be evaluated by extracting 1 whole number character, and numbers greater than 9.999 to be evaluated by extracting 2 whole number characters. Numbers between 100 and 999.99 would need to use the {MID} command to extract 3 whole number characters, and so on. The {MID} command is further explained on page 892 of the WP 5.1 Manual. Please note, the {COMMENT} command is used to avoid blank lines that are created during the merge.


{LABEL}start~{COMMENT}
~{IF}{MID}{FIELD}1~~0~1~>1&{MID}{FIELD}1~~0~1~<4~{COMMENT}
~{GO}merge~{COMMENT}
~{ELSE}{COMMENT}
~{NEXT RECORD}{COMMENT}
~{CALL}start~{COMMENT}
~{END IF}{COMMENT}

~{LABEL}merge~{COMMENT}
~{FIELD}1~

The conditional merge works as described, but on the last line at the end of the merged file, part of the {IF} statement is printed. To avoid the problem, make sure the last record in the secondary file is blank, i.e., the last record should contain nothing but one {END FIELD} code for each field in the record and the record should end with an [HPg] code.

Answer:

Details:


Product specifications, packaging, technical support and information (*Specifications*) refer to theUnited States retail English version only. Specifications for other versions may vary. All Specifications, claims, features, representations, and/or comparisons provided are correct to the best of our knowledge of the date of publication, but are subject to change without notice.OUR MAXIMUM AGGREGATE LIABILITY TO YOU AND THAT OF OUR DEALERS AND SUPPLIERS IS LIMITED. IT SHALL NOTEXCEED THE AMOUNT YOU PAID TO ACCESS THE INFORMATION. SEE LEGAL DISCLAIMER.