Alpha Video Training
Results 1 to 15 of 15

Thread: Copying Calculated Field to a Numeric Field

  1. #1
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default Copying Calculated Field to a Numeric Field

    I have a form which is based on the Alphasports invoicing form in which I enter items a Client has ordered and it calculates a grand total including Carriage & VAT. I wanted to use the total for each Customers invoice in a report so I setup an event to copy the value in the Calculated field to a numeric field (called ORDER_TOTAL). This numeric field is on the form but normally hidden.

    While I was making some changes to this form the other day I made the above field visible and while I was looking throught the invoices I noticed that the value stored in the ORDER_TOTAL field was different to the value in the calculated field!?

    The Calculated field displays £511.59 but the value copied into the ORDER_TOTAL field is displayed as £511.60. I suspected this could be a rounding error but this error only occurs on this one invoice and both of the fields are formatted with the same currency format e.g $123,456.78 width 10 decimal places 2.

    It only occurs on one of the invoices, but I cannot understand how this can be happening - can anyone explain this or has anyone else had this problem and found a way around it?

    Thanks,

    Alastair

  2. #2
    "Certified" Alphaholic
    Real Name
    Wanda Tucker
    Join Date
    May 2001
    Location
    Northern California
    Posts
    1,444

    Default RE: Copying Calculated Field to a Numeric Field

    Hi Alastair,
    I suspect rounding, as well. There may be an area where you can specify rounding - but I want to steer you in a different direction.

    Instead of copying the total fields, you can post them. I'm curious if that will bring the same results.

    Also, a much better idea is to create a report they way you want your invoices to look, and include the calculated field on the report.

    I hope this helps.

    Wanda

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

    Default RE: Copying Calculated Field to a Numeric Field

    How are you doing the copy?

    i.e. are you copying the "value" of the field object on your form that is displaying the computed result, or are you copying the computed result, itself ?

    -- tom

  4. #4
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Tom,

    Thanks for your reply, sorry I have not got back to you sooner but I have been on holiday for a few days!

    I am copying the values using the onfetch event of the form. Don't know if this is the best way to do this, but it seems to work.

    The value is set by a conditional action Order_total""grand_total and the field Order_total is set to the value of CALC-"grand_total.

    Alastair

  5. #5
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Hi Wanda,

    Thanks for your reply, sorry I haven't replied to you earlier but I have been on holiday for a few days.

    I haven't used posting before I will have to see how to do this - is it easy to set-up?

    Thanks,

    Alastair

  6. #6
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Hi Wanda,

    Forgot to ask in my previous post to you - what does the little envelope next to your post indicate?

    Alastair

  7. #7
    "Certified" Alphaholic
    Real Name
    Wanda Tucker
    Join Date
    May 2001
    Location
    Northern California
    Posts
    1,444

    Default RE: Copying Calculated Field to a Numeric Field

    Hi Alastair,

    Posting can be set up in field rules, or as an operation. The one in the field rules will post the result as the master table record changes, or is entered. Be careful to first select the table you want to post information TO, in the first column. You'll get to indicate the SOURCE, a few columns over from the first table. The SOURCE table is where the data is posted FROM.

    Posting via an operation is posted at will - whenever you want to run the operation.

    The envelope? What envelope?

    Wanda

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

    Default RE: Copying Calculated Field to a Numeric Field

    Alastair,

    If your calc field is defined in the form (and is not a field in your table) this might explain what you're seeing.

    The numeric field in your table has a fixed structure, and a defined number of decimals. If you assign a value to this field that contains additional decimals it will automatically round, because of the structure limitations.

    In contrast, a numeric form level calc field does not have a predefined limit on the number of decimals.

    If this is your situation, I suggest you change the numeric form level calc field definition to return the numeric value rounded to two decimals.

    -- tom

  9. #9
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Tom,

    I believe from examining both the calculated field and the numeric field that they both have the same formatting options e.g. currency width 10 and decimal places 2 - is this what you mean?

    Alastair,

    If your calc field is defined in the form (and is not a field in your table) this might explain what you're seeing.

    -- tom

  10. #10
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Wanda,

    I will have a look at this this may be a neater way to accomplish this!

    The envelope symbol I am talking about is shown in the list of posts at the top of this page. Not sure what it indicates but it only seems to be occuring next to your posts?

    Alastair

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

    Default RE: Copying Calculated Field to a Numeric Field

    Nope.

    -- t

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

    Default RE: Copying Calculated Field to a Numeric Field

    I was recommending that you incorporate the Round() function in the definition of your form level numeric calculated field. I said nothing about changing the display formatting options for either field. Sorry I wasn't clearer.

    -- tom

  13. #13
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Tom,

    I have read your previous post again and I think I now understand what you are saying. Is there any way to overcome this?

    Alastair

  14. #14
    Member
    Real Name
    Alastair Whyley
    Join Date
    Feb 2004
    Location
    Nottingham, England
    Posts
    371

    Default RE: Copying Calculated Field to a Numeric Field

    Tom,

    Yes, this is what the problem was. The rounding error was occuring in the VAT calculated field. With the use of the Round() function as you suggested this has solved my problem.

    Thanks ever so much for your help. After all the time I've spent looking at this minor problem. It is very satisfying to solve it at last!!!

    Alastair

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

    Default RE: Copying Calculated Field to a Numeric Field

    Great! I'm glad you have it sorted.

    -- tom

Similar Threads

  1. import a numeric field into a character field
    By dcorcoran in forum Alpha Five Version 6
    Replies: 5
    Last Post: 04-02-2005, 09:44 AM
  2. Copying Data from field to field
    By johnm in forum Alpha Five Version 5
    Replies: 4
    Last Post: 08-01-2004, 07:36 AM
  3. copying a calc field to a table field
    By Tom Dang in forum Alpha Five Version 5
    Replies: 5
    Last Post: 05-04-2004, 06:42 AM
  4. Calculated Field problem - Field Rules
    By Fred Daniel in forum Alpha Five Version 5
    Replies: 7
    Last Post: 03-26-2003, 07:41 AM
  5. Keeping numeric field numeric upon importing
    By David Farr in forum Alpha Five Version 5
    Replies: 2
    Last Post: 03-19-2003, 10:01 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
  •