Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Before Delete on subform

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
chpwebmaster
Posts: 72
Joined: Mon Jun 10, 2019 5:00 pm
Has thanked: 6 times
Been thanked: 4 times

Before Delete on subform

Unread post 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.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Before Delete on subform

Unread post by kev1n »

Use the BS event to retrieve that information.

Use

Code: Select all

nuDebug(nuHash());
to see the form's data structure.
chpwebmaster
Posts: 72
Joined: Mon Jun 10, 2019 5:00 pm
Has thanked: 6 times
Been thanked: 4 times

Re: Before Delete on subform

Unread post 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);
    }
}
Last edited by kev1n on Tue May 18, 2021 2:20 pm, edited 1 time in total.
Reason: Added Code tags.
Post Reply