Alpha Video Training
Results 1 to 6 of 6

Thread: How to let it change after post and edit data later.

  1. #1
    Member
    Real Name
    Peterth
    Join Date
    Oct 2009
    Posts
    278

    Default How to let it change after post and edit data later.

    Hi all,

    I have a invoice set the structure same as AlphaSport ; g1invoice_header (parent) and g1invoice_items(child) I post the member_id, date, and pay_method from g1invoice_header to G1invoice_items with this script below as the cansaverecord event code (field rules) for the g1invoice_items table

    if is_object("g1invoice set form")
    tbl = table.current()
    tbl.member_id = member_id.value
    tbl.date = date.value
    tbl.pay_method = pay_method.value
    end if

    I also created 3 fields ;member_id, date,and pay_method in G1invoice_items
    to receive the data from G1invoice_header when it posts the data to child table)

    After I try to post data many times (create new invoice, key in data, and save) I found that

    It can post the data (Member_id, Date, and Pay_method ) from G1invoice_header table to G1invoice_items table correctly BUT

    I found that if I come back and edit the data in G1invoice_header and save it again later. The data cannot post to G1invoice_items it can post only one time.

    How can I let it automatically post the data from G1invoice_header table to G1invoice_items every time I edit and save the data (Member_id, Data, and Pay_method) in G1invoice_header.

    Thanks
    Peter-th

  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: How to let it change after post and edit data later.

    Try this. I added onchange event code to the pay_method, date, and mem_id fields on the invoice form. When you change any of the three for the invoice the change will be written to all of the items for the invoice.
    There can be only one.

  3. #3
    Member
    Real Name
    Peterth
    Join Date
    Oct 2009
    Posts
    278

    Default Re: How to let it change after post and edit data later.

    Stan,

    Thank you for your quick response.
    I will test and learn it the attached file.

    Thanks
    Peter-th

  4. #4
    Member
    Real Name
    Peterth
    Join Date
    Oct 2009
    Posts
    278

    Default Re: How to let it change after post and edit data later.

    Stan,

    I try the attached sample , In design mode of invoice form I added the script for 3 fields ;Date,Member_Id,and Pay_method by right click Event---> OnChange and use the below script

    parentform.commit()
    tbl = table.current(3)
    tbl.fetch_first()
    while .not. tbl.fetch_eof()
    tbl.change_begin()
    tbl.pay_method = pay_method.value
    tbl.date = date.value
    tbl.mem_id = mem_id.value
    tbl.change_end(.t.)
    tbl.fetch_next()
    end while

    After I save the script ,go to browse mode and create a new invoice (just key in first,not come back to edit the data) during I key in the data it has an error below.

    "Script:OnChange line7
    tbl.fetch_first()
    Command does not work in change or enter mode."

    and after I click the error it has more an error below

    "Error posting to table G1product for record 1 error change already began"


    If I don't added the script Event OnChange on form, I can use the invoice with no problem it can post Date,Member_Id, and Pay_method from G1invoice_header to G1invoice_items but the data in G1invoice_items cannot be changed if I edit the data in G1invoice_header in invoice form later.

    Thanks
    Peter-th

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

    Default Re: How to let it change after post and edit data later.

    In your set is the invoice_items table in the third position down like AlphaSports?

    tbl = table.current(3)

    Note that the script is trying to post to the product table in your database.....

    "Error posting to table G1product for record 1 error change already began"



    You also need to change this line

    tbl.mem_id = mem_id.value

    to reference your member_id field and form objects.
    Last edited by Stan Mathews; 04-22-2010 at 11:01 AM.
    There can be only one.

  6. #6
    Member
    Real Name
    Peterth
    Join Date
    Oct 2009
    Posts
    278

    Default Re: How to let it change after post and edit data later.

    Stan,

    Due to for the first time I don't know the meaning of (3) the third position of the G1invoice_items table in the set. Now I change it to (2) because my invoice_items table is the second position in the set and it works great now

    Many many thank you Stan!
    Peter-th

Similar Threads

  1. Edit - Change Control Panel
    By forskare in forum Alpha Five Version 10 - Desktop Applications
    Replies: 5
    Last Post: 03-20-2010, 08:07 PM
  2. Change Default Edit/Save Icons
    By ChristopherG in forum Application Server Version 10 - Web/Browser Applications
    Replies: 7
    Last Post: 01-20-2010, 07:40 AM
  3. Change to form edit mode to allow more visibility
    By George Corder in forum Alpha Five Version 8
    Replies: 1
    Last Post: 04-10-2007, 10:21 AM
  4. Change field name, can't open and edit form
    By Ronald Anusiewicz in forum Alpha Five Version 8
    Replies: 6
    Last Post: 04-05-2007, 10:50 AM
  5. Expression edit/change bug (changes not kept)
    By pk9 in forum Alpha Five Version 7
    Replies: 0
    Last Post: 02-02-2007, 01:29 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
  •