Hi,
I follow a tutorial about app in offline mode, and looks fine.
Tutorial: https://matthewdevaney.com/power-apps-offline-mode-a-step-by-step-tutorial/
This is the code.
App property OnStart:
// get the current user's email
Set(
varUserEmail,
User().Email
);
Form Screen
Button Submit Form
/ update collection with form data
Patch(
colHomeInspections,
LookUp(colHomeInspections, ID=varCurrentRecord.ID),
form_Form_Main.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');
Admin Screen
tog_DebugMode
Default : True
Saving screen
OnVisible
If(!tog_DebugMode.Value, Select(btn_Saving_Actions))
Button Saving
// Check if device is online
If(Connection.Connected,
// Add or update records in SharePoint
Patch(
'Home Inspections',
// Choose which columns are written to SharePoint
ShowColumns(
// Only write records with ID found in colUnsavedRecords
Filter(
colHomeInspections,
ID in colUnsavedRecords.ID
),
"ID",
"Adress",
"StartTime",
"AsignedTo",
"Report"
)
);
// Clear unsaved records collection
Clear(colUnsavedRecords);
SaveData(
colUnsavedRecords,
"localUnsavedRecords"
);
);
UpdateContext({locMessage: "Saving completed"});
Navigate('Loading Screen');
Loading Screen
OnVisible
If(!tog_DebugMode.Value, Select(btn_Loading_Actions))
and my sharepoint list have the next fields:
- ID
- AsignedTo
- StartTime
- Adress
- Report
- Pic
- Ide
I see the app just works in offline mode, if I have internet appears an errors.
But the problem is, the app not save data in sharepoint list, for example, if I update a record, the information, than I changed is not saved in the list.
I attatch some pictures to explain better
Regards.