Archiving records

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
kanklovitch
Veteran Member
Posts:187
Joined: 2019-02-03 17:26

Archiving records

Post by kanklovitch » 2026-06-17 12:06

Hi All
Is it possible to archive records in a data base? I track the stages of jobs throughout the period of making them. Once them are made I make them inactive so I can sore them out. I would like to archive so them so they are never part of any search unless I want them to be.

Thanks

mdannatt
Veteran Member
Posts:55
Joined: 2020-01-27 17:34
Contact:

Re: Archiving records

Post by mdannatt » 2026-07-01 09:50

Hi there.
Not sure if I understand exactly what you need, but assume you don't want archived records to show up on any search?
your_table should include a include a tiny_int checkbox, caption 'is_archived' or similar.
the go to hooks/your_table.php, find your_table_init() hook, and replace the entire function with:

Code: Select all

function sales_init(&$options, $memberInfo, &$args) {
    $archiveFilter = "`your_table`.`is_archived` = 0";

    if(trim($options->QueryWhere ?? '') !== '') {
        $options->QueryWhere = "({$options->QueryWhere}) AND {$archiveFilter}";
    } else {
        $options->QueryWhere = $archiveFilter;
    }

    return true;
}
Obviously, if you already have something in init() hook, you should leave it in there as well and remember to replace 'your_table' with your actual table name.
SignGini: add a digital signature with full audit history and embedded security features to a table
FieldGuard: extend AppGini Permissions by making selected fields with sensitive information hidden or read only at runtime for individual members. Also works on filters, csv, print-preview.
GuestLink: create a secure one-time email link for a user without the need for a username and password. Great for surveys, sign-offs, etc.

mdannatt
Veteran Member
Posts:55
Joined: 2020-01-27 17:34
Contact:

Re: Archiving records: EDIT

Post by mdannatt » 2026-07-01 10:00

i didn't do a very good job of editing the code!
replace
function sales_init(&$options, $memberInfo, &$args)
with
function your_table_init(&$options, $memberInfo, &$args)
where your_table is the name of your actual table.
SignGini: add a digital signature with full audit history and embedded security features to a table
FieldGuard: extend AppGini Permissions by making selected fields with sensitive information hidden or read only at runtime for individual members. Also works on filters, csv, print-preview.
GuestLink: create a secure one-time email link for a user without the need for a username and password. Great for surveys, sign-offs, etc.

Post Reply