Hi Jody,

On Wed, May 30, 2018 at 10:39 AM Jody Bevan via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> 1. How can the parent form know that a change was made in the Subform
> Detail form (which is information from another table) so that it will save
> the record? Ideally I will be able to determine what changes were made in
> each field.
>

​Code in the subform executes CALL SUBFORM CONTAINER($myEvent)​
​$myEvent is a custom event number. It can be anything. If you just want to
know about basic events from the subform you can pass

Form event*-1​

​It's a good, but not required, idea to send the inverse of the Form event
to avoid confusion. Or you can make up your own numbers. Don't go crazy
with this - you probably only need one or two.

Back on the parent form the subform object receives this and you can read
it with the Form event function. Here's the thing - this form event fires
on the subform no matter what. So you don't need to enable the subform for
anything for this form event to fire there. In fact I pretty rarely use any
of the parent level form events on my subforms.

However, if you are manipulating data in another table in the subform I'd
encourage you to manage the saving of that record in the subform code. The
idea being to encapsulate the subform operations within themselves.

Remember that the subform maintains its own memory space for local vars (so
$myVar on the parent isn't seen by subform methods and vice versa).
Subforms also have their own name space, so an object named "form_title"
can exist on the parent form and the subform with no conflict.

HTH
-- 
Kirk Brooks
San Francisco, CA
=======================

*We go vote - they go home*
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to