Hello everyone,
I have a problem that I could edit a form delete a row but I couldnt insert a new row . What am I missing here ?
First step is save to a collection.
// update collection with form data
Patch(
colHomeInspections,
LookUp(colHomeInspections, ID=varCurrentRecord.ID),
Form1.Updates
);
// save collection to local device
SaveData(
colHomeInspections,
"localHomeInspections"
);
/* more code added below */
// track record that was edited
Collect(
colUnsavedRecords,
{ID: varCurrentRecord.ID}
);
// save collection to local device
SaveData(
colUnsavedRecords,
"localUnsavedRecords"
);
Navigate('Saving Screen');
Here I patch it to sharepoint list
UpdateContext({locMessage: "Saving your data..."});
// Check if device is online
If(Connection.Connected,
// Add or update records in SharePoint
Patch(
tilla_records,
ShowColumns(
Filter(
colHomeInspections,
'OfflineID ' in colHomeInspections.'OfflineID '
),
"ID",
"EventID",
"Title",
"Firma",
"Name",
"Notizen",
"Datum",
"dcfcNummer",
"Kundenstatus",
"ErstellerMail",
"Prioritaet",
"OfflineID",
"Check"
)
);
// Clear unsaved records collection
Clear(colUnsavedRecords);
SaveData(
colUnsavedRecords,
"localUnsavedRecords"
);
// Delete records from SharePoint
ForAll(
colDeletedRecords,
Remove(
tilla_records,
LookUp(
tilla_records,ID=colDeletedRecords[@ID]
)
)
);
// Clear deleted records collection
Clear(colDeletedRecords);
SaveData(
colDeletedRecords,
"localDeletedRecords"
);
);
//Collect(colBidon,Filter(colHomeInspections,OfflineID in colUnsavedRecords.OfflineID));
UpdateContext({locMessage: "Saving completed"});
Navigate('Loading Screen');
Hey!
To add a new row using Patch you need to do this:
Patch(
DataSource,
Defaults(DataSource),
{
...
}
)
https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-patch
If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!
Best regards,
Gonçalo Nogueira
Check my LinkedIn!
My website!
User | Count |
---|---|
251 | |
126 | |
107 | |
50 | |
49 |