Alpha Video Training
Results 1 to 7 of 7

Thread: Update a field during processing a Report

  1. #1
    Russell Sanderlin Sr
    Guest

    Default Update a field during processing a Report

    Hello Gang,

    I have put this request in before and I am still stumped.

    What I want to do is update a DATE field with todays date for a group of records that are requested in a REPORT.

    Could someone help me step by step please, hopefully using the Code Editor.

    And if the Code Editor is not applicable, another option step by step.

    It would be much appreciated.

    Thanks for the help - Russell

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

    Default RE: Update a field during processing a Report

    Sure.

    First, post a sample table and it's dictionaries so we have something to work with. The table should be the one your report layout is based upon. If your report is based on a set of tables we'll need all the tables, all their dictionaries, and the dictionaries for the set.

    -- tom

  3. #3
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Update a field during processing a Report

    Place the following code after your report print code.

    tbl = table.open("your_table_name")
    query.filter = "exact_same_filter_you_used_for_your_report"
    query.order = "recno()"
    ix = tbl.query_create()
    tbl.fetch_first() 'fetch first in filtered list
    while .not. tbl.fetch_eof()
    tbl.change_begin(.t.)
    tbl.your_date_field_name = date()
    tbl.change_end(.t.)
    tbl.fetch_next()
    end while
    tbl.close()

  4. #4
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Update a field during processing a Report

    I've done as Cheryl suggested many times but I sure wish there was a way to change a field as each record was actually printed (not previewed!) so it would mark what was actually done but not mark those records that were missed because of some printing error.

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

    Default RE: Update a field during processing a Report

    Cal, I like Cheryl's code, too. However, as I mentioned in the other Sanderlin thread on this subject, I think it's prudent to query the user with a ui_msg_box() to verify that the report printed ok. If they say no, the script can abort without marking or otherwise modifying the records that were included in the print range.

    -- tom

  6. #6
    Russell Sanderlin Sr
    Guest

    Default RE: Update a field during processing a Report

    Thanks Tom,

    I still have that info, but have been dealing with some personal issues and have not had time to try anything yet.

    I am still not clear in the DESIGN mode where to put your code.

  7. #7
    Russell Sanderlin Sr
    Guest

    Default RE: Update a field during processing a Report

    Hello Cheryl,

    Thanks for the info.

    Now let me go and find where that should be placed.

    Thanks much, Russell

Similar Threads

  1. update Logical Field from Date Field
    By John Burke in forum Alpha Five Version 5
    Replies: 13
    Last Post: 05-05-2005, 11:22 AM
  2. Adding a Date To Field during Report Processing
    By Russell Sanderlin Sr in forum Alpha Five Version 5
    Replies: 3
    Last Post: 01-30-2005, 01:57 PM
  3. Newbie, field update from other table field
    By Peder Lundstrom in forum Alpha Five Version 5
    Replies: 1
    Last Post: 05-07-2004, 05:49 AM
  4. Report pre-processing
    By davidv43 in forum Alpha Five Version 5
    Replies: 2
    Last Post: 08-21-2002, 05:20 AM
  5. Calculated field on a report -an update & ques
    By Selig Starr in forum Alpha Five Version 4
    Replies: 4
    Last Post: 04-06-2000, 09:14 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
  •