cancel
Showing results for 
Search instead for 
Did you mean: 
LRVinNC

How-to: Update multiple data sources from an edit form

A question I often receive is how to update more than one list when using an edit form.  Since the edit form is linked to one specific data source and updated when you invoke the SubmitForm function, a second update mechanism is required.  The solution lies in the use of the Patch function in conjunction with SubmitForm.

Here's an example from one of my apps to illustrate.  When an update is made to a project record, I also want to record two additional updates --  record today's date as the last update date for the department to which the project belongs and create an audit trail record to show what was updated.  

I let the EditForm handle the heavy lifting of the project record update since that's where the bulk of my updates are taking place.  To save my changes to the edit form, I have a check icon.  In the OnSelect property of this check icon, I'll handle all the updates to the data sources.  
Patchexample2.jpg

 

In addition to executing the SubmitForm(EditProject), I'll also execute two Patch statements - the first adding a new audit trail record and the second updating an existing department record.

PatchExample.jpg

 

Here's the results of the two patch functions we executed as shown in two separate administrative reports from the system - the first for the department last updated information and the second displaying the audit trail.
PatchExample3.jpg

 

So if you have more than one data source to update, use Patch in conjunction with SubmitForm to achieve your objective.

Comments