Page 1 of 1

Before Delete on subform

Posted: Tue Apr 20, 2021 7:18 pm
by chpwebmaster
Is there a way I'm missing or can it be added to have a Before Delete event on a subform I tried a

Code: Select all

nuDebug('Deleting');
on the main forms Before Delete and got noting when I deleted a subform row what I want to end up with is a way to run a check on one of the subform rows and log to another table if the row was a late charge.

Re: Before Delete on subform

Posted: Tue Apr 20, 2021 8:17 pm
by kev1n
Use the BS event to retrieve that information.

Use

Code: Select all

nuDebug(nuHash());
to see the form's data structure.

Re: Before Delete on subform

Posted: Tue May 18, 2021 2:09 pm
by chpwebmaster
Solved

Code: Select all

$rows = nuSubformObject('FormName')->rows;

foreach($rows as $key => $row){
    if($row[5] == 'Late Charge' && $row[10] == 1){ // Col 5 is the nuHash col with my charge Method and 10 is the one tracking the delete state
        // Logging LC Removal to History
        $q  = "INSERT INTO `tblEventLog` (`EventID`, `AssocBillingID`, `Action`, `ActionDate`) VALUES (NULL, '#BillingID#', 'LateChargeRemoved', CURRENT_TIMESTAMP);";
        nuRunQuery($q);
    }
}