@TickboxPhil
There's no specific documentation on when to use one over the other. I prefer the UpdateIf when dealing with a single record or a group of records with similar matching criteria.
NOTE: UpdateIf returns a table of the datasource with the updated record. For those that use collections, this is important to note as you can use the output of the UpdateIf to refresh the collection. If you just want the record you updated from the UpdateIf, you can use a LookUp on the UpdateIf ex. LookUp(UpdateIf(someDataSource, ID=5, {some record}), ID=5) This will return the updated record only.
Patch puts records together from left to right.
Patch(record1, record2, record3) will combine all three records into one record with overriding values replaced from left to right. Patch also allows a datasource (table) to be used as the first parameter. The concept though is still the same...patch left to right. So, the reason you'll see Patch(dataSource, LookUp(...) is because the LookUp is going to have to return a record that will be the next param and then it will combine the record as mentioned above, and, because it recognizes the dataSource, it will then also patch the identical record in the datasource.
This process takes two steps, one to lookup the record and then another to update it. As opposed to UpdateIf that will do it in one shot based on the criteria of the UpdateIf.
One other distinction...you cannot use UpdateIf to create a record, you must do a Patch and supply the Defaults of the datasource (this will be a blank record with any default values in it).
As for the error...you can actually go about it another way:
UpdateContext({recordErrors:
With({patchResults:
ForAll(galTimeEdit.AllItems As source,
{rowID: source.TimeID,
result: LookUp(
UpdateIf('[testing].[tbl_Time]',
TimeID = source.TimeID,
{StartDate: DateValue(txtStartDate.Text)}
),
TimeID = source.TimeID
)
}
)
},
ForAll(patchResults,
{error: Errors('[testing].[tbl_Time]', result)}
)
)
})
This will set a context variable with all the records and their individual table of errors (if any). You would probably want to even further filter that for only records that have errors.