Top Navigational Bar

Assigning Numbers to Variables, Seperated By
DocumentID: 603346
Revision Date: 29-Feb-96 1:29:45 PM

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

Problem

Symptoms: A negative number displays when assigning a phone number or Social Security number to a variable by using {ASSIGN}1~123-4567~. In contrast using the macro command {TEXT}x~message~ to assign a number like 10-5 to a variable puts the string 10-5 in variable x. Is this feature working correctly?

This also happens with using the Assign command and assigning numbers that contain a "+", "/" or "*". Solutions: Users can put a hard hyphen (Home,-) in place of the regular hyphen, and WordPerfect will treat the phone number as text and print it correctly. Any text character will signal WP to treat the number as text instead of a numerical value.

To put a hard hyphen in a macro, press Alt-Hyphen or Ctrl-V-Home-Hyphen.
In a macro the command would look like the following:

Pressing Alt,- produces {ASSIGN}1~123{-}4567~
Pressing Ctrl-V-Home-Hyphen produces {ASSIGN}1~123{Home}-4567~

{ASSIGN}1~~
{ASSIGN}2~{VAR1}123-45-6789~
or
{ASSIGN}1~123-45-6789~

The following operators can only use the later or space example given above. "+", "/" and "*". Causes: WP is working as Designed, WP is looking at the first character in the assign statement and if it is a number WP considers what follows to be a value or a mathematic expression and is literally subtracting 4567 from 123. This is the case with the other symbols as well. Any Strings that start with numbers and that contain any character that WP may interpret as a mathematical operator are treated as expressions.

The following are all mathematical operators to WP, "-" is Minus, "+" is Add, "/" is Divide and "*" is Multiply.

If any of these characters are contained in an ASSIGN statement WP will perform the appropriate math function and return the resulting value rather than the original assigned string.

Note: WP variables can not store Factional values and will truncate any remainders or decimal values. For example {ASSIGN}X~25/5~ returns 5, {ASSIGN}X~25/4~ returns 6~ not 6.25 and {ASSIGN}X~25/100~ returns 0 not .25.

This is not the case with a {TEXT} command because WP assumes that if you are using a {TEXT} command you want everything entered in it to be text or a String and not a Value.

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.