Update Another Table's DateTime Field

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
yonder
Posts: 28
Joined: 2018-05-01 12:19

Update Another Table's DateTime Field

Post by yonder » 2018-08-13 13:08

Hi there,

I have 2 tables; "Projects" and "Projects_Details".

First table's fields;
- id
- project_no
-project_name
- last_update_datetime

Second table's fields;
- id
- project_no (it's lookup field that get data from first table)

When i add a new record to the second table, i want to add automatically date and time to the first table's "last_update_datetime" field (i mean i want to do that with "before update" or "after update" hook).

How can i do that?

Best Regards.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Update Another Table's DateTime Field

Post by pbottcher » 2018-08-13 14:50

Hi,

you can just add in the Projects_Details_after_update function:

Code: Select all

sqlvalue("update Projects set last_update_datetime=now() where id = ".$data['project_no']);
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply