Results 1 to 3 of 3

Thread: aftercreate to add child records

  1. #1

    aftercreate to add child records

    When I add a new parent record, I want to populate the child with several records.

    I used aftercreate, as follows:

    Code:
    // Event delegate for 'aftercreate' event
    proc Parent_Child_section1_aftercreate()
    	// insert your code here
    	rem_sel = select()
    	rem_acc_cid =  account.cid
    	select period
    	kkper = 0
    	scan
    		select accdet
    		append blank
    		replace accdet.fk_acc with rem_acc_cid
    		replace accdet.fk_per with period.cid
    		replace accdet.ddaat with period.daat
    		kkper = kkper + 1
    	endscan
    	select (rem_sel)
    	messagebox(ltrim(str(kkper)),64,'Periods added')
    endproc
    There are 6 records in the period file; the above does create the 6 records, but only the first 5 have all the information written to the table.

    Name:  Lx1.jpg
Views: 59
Size:  49.7 KB

    What should i do to ensure that the last record added is written properly?
    Regards
    Cyril

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,162
    Blog Entries
    22
    skip 0

    or

    tableupdate()

    That will flush the changes.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Quote Originally Posted by barrymavin View Post
    skip 0

    or

    tableupdate()

    That will flush the changes.
    Thanks, that works.
    Regards
    Cyril

Bookmarks

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
  •  
Journey into the Cloud
Join us