Create a Copy of Current Record after Editing to another Table (children records) (change log)

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
tminh
Posts: 28
Joined: 2019-05-23 02:26

Create a Copy of Current Record after Editing to another Table (children records) (change log)

Post by tminh » 2020-09-27 02:44

How do i Create a Copy of Current Record after Editing to another Table (children records)
I mean a change log record everytime editting.

I create 2 tables.

*Table A:
- Property Address
- Width
- Floor
..


*Table B (same as Table A, but lookup and child record):
- Property Address (lookup to Table A - Property Address)
- Width
- Floor
..


What i want is: everytime i edit a record of Table A, it will automatically copy the current record to Table B (as a change log) - child record. So that i can see all edit history of a record from Table A.

I know i can start with : function bds_after_update
but i still have no idea. Please help.

thanks

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Create a Copy of Current Record after Editing to another Table (children records) (change log)

Post by onoehring » 2020-09-28 15:48

Hi,

just a quick answer.
I did something similar using the Audit Log (see my footer).
The audit log keeps track of all changes in table A - done.
If you want to see that history, I suggest:
1. create a view in your database which reads the audit log for table a (you can skip this, if you only use audit log for table a)
2. create a "fake" table in AG which has the fields (from the view/audit log) that you want to show to the user. Then show data from the audit log which matches the primary key of your item in table a.

.... well not sure, I described this correct - was a long day. Essentially: Look at the audit log ;-)

For me it looks like this:
Image

Olaf


Post Reply