Alpha Video Training
Results 1 to 4 of 4

Thread: Negative Number Instead of Positive Number

  1. #1
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default Negative Number Instead of Positive Number

    I have the following expression in a calculated field in the table's Field rules):

    RETAIL_PRICE-CUST_PRICE*QTY

    It returns a negative number. For instance; 18.45-14.76*3 = -25.83 instead of 11.07
    What do I need to change?

    Thanks,

    kenn

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default RE: Negative Number Instead of Positive Number

    Tell Alpha in what order to evaluate the expression.

    (RETAIL_PRICE-CUST_PRICE)*QTY

  3. #3
    "Certified" Alphaholic forskare's Avatar
    Real Name
    Ken Nordin
    Join Date
    Apr 2000
    Location
    Walker, MN
    Posts
    7,545

    Default RE: Negative Number Instead of Positive Number

    Of Course!!! Oh Dah!!!!

    Thanks Stan,

    kenn

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,310

    Default RE: Negative Number Instead of Positive Number

    For any who may be 'looking in' on this thread,

    Ken's original expression gave the wrong number because the multiplication operation takes precedence over the subtraction. The expression is not evaluated from left to right. It's evaluated in order by arithmetic operator precedence.

    This is explained in the User's Guide at p 207 in the discussion of 'Arithmetic Operator Precedence'.

    Interestingly, the example give in the book says:

    3 + 4 * 5 is equivalent to 3 + (4 * 5) since the multiplication operation takes precedence over the addition operator.

    -- tom

Similar Threads

  1. negative number input
    By kevinsmith in forum Alpha Five Version 6
    Replies: 2
    Last Post: 10-31-2004, 02:21 PM
  2. Transposing a negative number to a blank field
    By Charles Scott in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-16-2004, 04:12 AM
  3. Print positive value for a negative
    By Patrick Browne in forum Alpha Five Version 5
    Replies: 6
    Last Post: 01-20-2004, 06:44 AM
  4. Total using negative number
    By NBGH in forum Alpha Five Version 5
    Replies: 9
    Last Post: 05-26-2003, 01:41 PM
  5. Negative Number Display
    By JohnZaleski in forum Alpha Five Version 4
    Replies: 6
    Last Post: 04-24-2001, 04:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •