Hi, I've been trying to write to a collection (UserData) and then patch updates from the collection to SP. I succeed in creating the record, but my attempts to update it further all fail, no matter how creative I get with the coding.
My initial attempts evaluating IsBlank to create a new record or update an existing one resulted in a new record being created for each update, despite my formula including a lookup in the patch so that the correct record should be updated. The same happened when I tried rewriting it to use the Coalesce function.
I've tried to rewrite it so that it uses an entirely different formula to handle updates instead, but none of the updates appear to be being written to the datasource, despite being correctly patched to the collection from the various controls.
I'm forced to include the With function, or else it cannot identify the columns ProjectName, etc. I tried a variation omitting the With and patching the updates as Title:varTodaysTimes.ProjectName, but again the updates weren't patched.
If(varTodaysTimes.Update = true,
With(varTodaysTimes,
Patch(TimeSheet,
LookUp(TimeSheet, ID = SharePointID),
{
Title:ProjectName,
EmployeeName:EmployeeName,
Date:Date,
StartTime:StartTime,
StartWork:StartWork,
BreakStart:BreakStart,
BreakEnd:BreakEnd,
EndWork:EndWork,
EndTime:EndTime,
ActiveSession:ActiveSession
}
);
Patch(UserData, varTodaysTimes,
{Update:false}
)
)
);
Each control has a separate patch that writes Now() to the collection UserData and updates the column Update to true. The above patch should then write the same info from the collection to the datasource.
If anyone can shed any light on what I'm missing (or point me in the right direction if I'm completely off the mark!), I'd be eternally grateful 🙂