Alpha DevCon 2018
Results 1 to 10 of 10

Thread: Maintaining all changes to the data

  1. #1
    Member
    Real Name
    Dan Latshaw
    Join Date
    Feb 2015
    Posts
    41

    Default Maintaining all changes to the data

    I am rebuilding an Alpha database for a non profit that provides funds to residents of a county. If someone needs rent money, to pay the heat bill, or pay the electric bill they come to this office.

    Currently all info about the visit is in one table! So there can be a limited number of family members, etc, and you have to change data ( like last name changes ) and there is no record of the previous information. They want to keep ALL information.

    What i have so far is:

    General table Name, SSN, clientID
    Family table Name, Relation, clientID
    Address table City, State, clientID
    Visit table Need, Notes, clientID

    (please note, i've not listed EVERY field)

    So everything links back to the Primary Key General.clientID. I can have as many rows in Family, Address, and Visit as i want and link them to one applicant in General.

    I set up everything that way before i realized that the client wants to be able to keep everything. If John Smith comes in and changes his name to John Doe they want to be able to know that he was smith and doe. If he comes in with a different SSN they want to keep both.

    All I've been able to think of is creating a Control table with controlID and clientID and making General.clientID not a Key so that i can have something like this:


    CONTROL
    CID | clientID
    001 | 1
    001 | 2

    GENERAL
    First | Last | CID | clientID
    John | Doe | 001 | 1
    John | Smith | 001 | 2


    I'm sure someone here can come up with a better way. It gets kinda hairy going down to visits, family, etc...

  2. #2
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,319

    Default Re: Maintaining all changes to the data

    In my directory table I use 2 keys, one is a natural key and the other is a primary key. The natural key is what the user sees, but the primary key cannot be changed and provides the link to the other records. Thus if Jane Doe marries and becomes Jane Smith, you won't lose any links, even if you change the natural key from DOEJ to SMIJ (just an example) the primary key of D001 doesn't change.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  3. #3
    Member
    Real Name
    Dan Latshaw
    Join Date
    Feb 2015
    Posts
    41

    Default Re: Maintaining all changes to the data

    Thank you for taking time to answer!

    But I want to know that Jane Smith was once Jane Doe. I do not see how this will maintain Jane Doe.

    This is sort of like versioning. I need to be able to pull out every "version" of Jane Doe. Because Jane Doe might change to Jane Smith or Jane Jones. If 5 years they might want to pull out Jane Smith Data.

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,319

    Default Re: Maintaining all changes to the data

    What about a 'changes' table that links the primary key to other fields where you look up the type of change and then enter the details into a general description field, and add a field for the date of the change.

    Then you can filter the table by the primary key and search by type and order by date in a browse or report.

    If you use previous values for the type field lookup, your users can add new types when they run into one. Or you can create a type table and let them modify that.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    VAR
    Real Name
    Mike Reed
    Join Date
    Apr 2000
    Location
    Phoenix, AZ
    Posts
    627

    Default Re: Maintaining all changes to the data

    Don't know if this is SQL table or not. If is is, then create a series of triggers in the sql table to add a row to a "log" table each time time there is change. The log file will then have all changes. I use that quite a lot
    Mike Reed
    Phoenix, AZ

  6. #6
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,857

    Default Re: Maintaining all changes to the data

    sql triggers are similar to field rules.
    You can do the same there.

    You can have an extra table where those name changes are kept right along with the id number. A little bit of code and an on change to a name can add the old and new names to the table.
    Dave Mason
    dave@aldaweb.com

    Skype is dave.mason46

  7. #7
    Member
    Real Name
    Doron
    Join Date
    Dec 2011
    Location
    NJ, USA
    Posts
    165

    Post Re: Maintaining all changes to the data


  8. #8
    Member
    Real Name
    Dan Latshaw
    Join Date
    Feb 2015
    Posts
    41

    Default Re: Maintaining all changes to the data

    Does anyone have an example of the "onChange"?

    I have read Dorons article and found it helpful, but not in my current conundrum. I will apply his advice to another part of the project, however. When it comes to tracking grant codes.

    In DaveM's comment he mentions another table for name changes. That table would need to contain fields for every field i wish to track changes, correct? They want to be able to track changes in SSN (typos, fraud, etc) changes in gender, marital , etc.

    Would it be wise to create an onChange that adds antother record with same clientID, different Primary key, different mod date, but copy all data from original record?

    Example:

    1 john doe 11.11.2011 male CLID1

    Changes name

    285 jack doe 12.12.2015 male CLID1

    Changes Gender

    58468 jane doe 10.10.2020 female CLID1

    So i could do select * from client where clid=CLID1 order by date

    and get all version of CLID1? How would i do the onChange? (I usually use php and mysql so this is a bit different for me.)

  9. #9
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,857

    Default Re: Maintaining all changes to the data

    1 way to do an onchange:
    table with id and several other fields, you can use an onedit event of the record to copy all current data needed to track to a variable and write it to a record in the tracking table into a blob/large text/memo field with the id as a new or existing record. Then on save would do the same with the new changed data if the variable is not blank.
    Means you could trace 1 field or 100 fields at a time.
    Just a thought.

    PHP is probably easier for this.
    Dave Mason
    dave@aldaweb.com

    Skype is dave.mason46

  10. #10
    Member
    Real Name
    Dan Latshaw
    Join Date
    Feb 2015
    Posts
    41

    Default Re: Maintaining all changes to the data

    thanks for the idea. I wish they had the budget to let me do all that i want to do. php/mysql would be much easier for me.

Similar Threads

  1. v11 Beta while still maintaining v10.5 application
    By christappan in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 09-25-2011, 02:18 PM
  2. Maintaining users in a web app
    By MikeBalemi in forum Application Server Version 9 - Web/Browser Applications
    Replies: 6
    Last Post: 06-08-2010, 03:09 PM
  3. Maintaining selected record between form and browse
    By RHoward3232 in forum Alpha Five Version 8
    Replies: 4
    Last Post: 05-14-2007, 06:30 PM
  4. Maintaining optimized applications
    By whanigsberg in forum Alpha Five Version 5
    Replies: 5
    Last Post: 10-02-2005, 09:37 PM
  5. Maintaining an A5 table from Visual Basic.NET
    By Marcel Kollenaar in forum Alpha Five Version 6
    Replies: 5
    Last Post: 12-20-2004, 02:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •