Alpha Video Training
Results 1 to 6 of 6

Thread: UX calculated value overwrites data inserted from the Grid

  1. #1
    Member
    Real Name
    Brad Steinfeldt
    Join Date
    Feb 2002
    Location
    Murray, Utah
    Posts
    137

    Default UX calculated value overwrites data inserted from the Grid

    I'm creating a UX Component to edit data from a Grid. On the UX, I have several calculated fields. The calculated fields will re-calculate each time the UX is loaded and fill in the corresponding controls, but I don't want that. I want the original values from the grid to be written in the controls as a priority. Then, if the user wants to recalculate, he can.

    What's the best way I can do it?




    If I'm not making sense, here's an example:

    Grid Data--
    SubTotal = 50.00
    TaxRate = .05
    GrandTotal = 52.50 This is a value written in the field. It's not a calculated field, though it was calculated from the value of SubTotal + (SubTotal * TaxRate).

    Controls on the UX as recalculated:
    SubTotal = 50.00
    TaxRate = .10 -- Calculated field which gets the current tax rate from an argument on the UX
    GrandTotal = 55.00 -- Calculated field of SubTotal + (Subtotal * TaxRate)

    If I'm just viewing the record, or if I'm just going to make other details in other fields, I don't want the new calculated values overwriting the old data.
    Brad Steinfeldt

  2. #2
    Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,434

    Default Re: UX calculated value overwrites data inserted from the Grid

    You could create an unbound text field and checkbox, write the value from the database to that field, then upon saving or exiting the UX, if the checkbox has been checked, write the value back to the database with an Ajax Callback.

    And just to clear things up, I suspect that you are not "editing data from a Gird", I suspect that you are "editing data in a database that was originally entered by a grid."

    Jay
    Jay Talbott
    Lexington, KY


  3. #3
    Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,434

    Default Re: UX calculated value overwrites data inserted from the Grid

    If you need further help, let us know.
    Jay
    Jay Talbott
    Lexington, KY


  4. #4
    Member
    Real Name
    Brad Steinfeldt
    Join Date
    Feb 2002
    Location
    Murray, Utah
    Posts
    137

    Default Re: UX calculated value overwrites data inserted from the Grid

    Thanks for the reply. Yes, you're correct-- I'm "editing data in a database that was originally entered in a grid."

    I'm thinking through your approach... I was considering a checkbox with an if statement on my calculated fields, but once the checkbox is checked, the old data is gone. Your method would allow the user to lookover the calculated data and then commit.

    My javascripting is basically non-existent. Do you see any problem with using a checkbox or button to write the calculated data into the bound fields, and then it's saved automatically when submitted?
    Brad Steinfeldt

  5. #5
    Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Versailles, KY
    Posts
    1,434

    Default Re: UX calculated value overwrites data inserted from the Grid

    I think that is a valid idea. There is an action javascript to set the value of one control from the value in another control. I would use that.

    {dialog.object}.setValueFrom(target,source);

    There is documentation here:

    https://documentation.alphasoftware....m%20Method.xml
    Jay Talbott
    Lexington, KY


  6. #6
    Member
    Real Name
    Brad Steinfeldt
    Join Date
    Feb 2002
    Location
    Murray, Utah
    Posts
    137

    Default Re: UX calculated value overwrites data inserted from the Grid

    Thanks so much. I'll read up on it.
    Brad Steinfeldt

Similar Threads

  1. Code Editor Overwrites Script
    By MoGrace in forum Alpha Five Version 11 - Desktop Applications
    Replies: 11
    Last Post: 06-08-2016, 03:54 PM
  2. Need some help with posting calculated data and refresh calculated data
    By markbwillard in forum Alpha Five Version 11 - Desktop Applications
    Replies: 6
    Last Post: 05-14-2013, 10:52 AM
  3. Inserted Linked Grid NOT following master
    By saskat in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 02-23-2011, 02:37 PM
  4. Table Self Lookup Overwrites
    By ryland@rylandwiltshire.co in forum Alpha Five Version 9 - Desktop Applications
    Replies: 3
    Last Post: 02-11-2009, 12:58 PM
  5. Restoring New Database Overwrites Others
    By Dave Whittle in forum Alpha Five Version 5
    Replies: 1
    Last Post: 11-01-2002, 03:24 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
  •