Alpha Video Training
Results 1 to 6 of 6

Thread: Setup to add new record after adding a record

  1. #1
    Member
    Real Name
    Alan Sawyer
    Join Date
    Apr 2006
    Location
    western New York (rural)
    Posts
    261

    Default Setup to add new record after adding a record

    I have a UX component. I have a save button and it's doing this in the AfterDialogValidation.

    ExecuteServerSideAction("Save Data::Save_Submitted_Data_to_Table_s_")


    Which saves the record. What I would like to do is two things.

    1. Save off one of the fields and use it as a default for the a new record
    2. After the record is saved, clear the fields (other than the default mentioned above) and be ready for the user to enter more information.


    Thanks in advance

  2. #2
    Member
    Real Name
    Alan Sawyer
    Join Date
    Apr 2006
    Location
    western New York (rural)
    Posts
    261

    Default Re: Setup to add new record after adding a record

    Part of my issue was that I had not selected add a new record when I called the UX component. So other than saving the existing field and using as a default, I think I'm okay

  3. #3
    Member
    Real Name
    Alan Sawyer
    Join Date
    Apr 2006
    Location
    western New York (rural)
    Posts
    261

    Default Re: Setup to add new record after adding a record

    It was suggested that I should use a list control to enter the records. Might be a good idea, so I will try to find any videos that show that. That might also help with the using existing field.

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,546

    Default Re: Setup to add new record after adding a record

    The List Control is a bit more overhead. If you want to stick with your Data Bound UX you can add this to your afterDialogValidate event. There are a few ways to accomplish pretty much the same thing.

    After your ExecuteServerSideAction, you can send back Javascript to execute at the client side.

    Code:
    ExecuteServerSideAction("Save Data::Save Data")
    
    e.javascript = e.javascript + crlf() + "setupNewRecord();"
    The Javascript function setupNewRecord would be this...

    Code:
    function setupNewRecord(){
    	
    	var lastName = {dialog.Object}.getValue('LASTNAME');
    	{dialog.Object}.newRecord();
    	setTimeout(function(){
    		{dialog.Object}.setValue('LASTNAME',lastName);
    	},100);
    	
    }
    Here you're grabbing the value you want to save, executing a new record, then using a .setValue() to populate that field. You must have a bit of setTimeout because it's takes a bit of time to establish the new record.

  5. #5
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,049

    Default Re: Setup to add new record after adding a record

    isn't 100 a bit too short? I usually use 1000 - am I adding in too much of a wait?
    NWCOPRO Nuisance Wildlife Control Software-My Application: http://www.nwcopro.com "I am not discouraged, because every wrong attempt discarded is another step forward."

  6. #6
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,546

    Default Re: Setup to add new record after adding a record

    You need to try it in order to see what works best for you. 50 was too short... 100 worked. If 100 doesn't work, but 400 does, why spend the extra time.

Similar Threads

  1. Fastest Method of Adding New Record to A form and Posting Data to New Record
    By nigeldude in forum Alpha Five Version 11 - Desktop Applications
    Replies: 10
    Last Post: 10-14-2018, 12:59 PM
  2. How to Prevent Adding New Record when Submitting Edits to an Existing Record
    By cpgood in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 07-11-2014, 09:25 AM
  3. Detail View differences when adding a new record versus editing an existing record
    By jackp_MDB in forum Application Server Version 11 - Web/Browser Applications
    Replies: 12
    Last Post: 05-14-2013, 04:20 PM
  4. record navigator - adding new record
    By pja67 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 1
    Last Post: 02-22-2009, 06:07 PM
  5. Replies: 4
    Last Post: 12-26-2005, 07:08 PM

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
  •