I am building my first app utilizing Savedata/Loaddata to keep some local user settings and unsent orders caused by lack of connectivity. I've searched and searched, and I can't seem to figure out what the issue is. Hopefully someone here can?
In App.OnStart I have Loaddata functions to recall saved data, and if no files were found to create the collections. (i.e. first time user). If it's a new file I have it Savedata and I don't see any issues.
I have a Settings Screen I've built where the user can modify some of the record fields in that data collection. The controls patch part of the record, and then when the "Save" button is pressed, it patches others and then is supposed to Savedata the collection but I get the error I put in the subject.
I've tried versions 3.23033.11, .14 & .15. I've tried putting in the ClearData command before the save data. I've tried on both the web player and on my iphone and received the same issue.
The collection is only one record, with 26 fields. Does anyone know what I'm doing wrong?
Thank you!
//Test network connection
If(
!Connection.Connected,
Notify(
"No Connection to Server, Please try again at another time.",
NotificationType.Error
),
//Display loading/working spinner
UpdateContext({SettingsWorking: true});
//If user chooses not to keep order history, clear the collection
If(
!togPhone_Settings_Theme_1,
Clear(colOrderHistory)
);
//Check if users has changed markets
If(
cbPhone_CommunityChoice_1.Selected.Name <> First(colUserData).MarketName,
//If user has, update UserData
Patch(
colUserData,
First(colUserData),
{
MarketName: cbPhone_CommunityChoice_1.Selected.Name,
MarketCode: Value(cbPhone_CommunityChoice_1.Selected.LawsonID),
MarketStreet: cbPhone_CommunityChoice_1.Selected.StreetAddress,
MarketCity: cbPhone_CommunityChoice_1.Selected.City,
MarketState: cbPhone_CommunityChoice_1.Selected.State.Value,
MarketZip: cbPhone_CommunityChoice_1.Selected.Zip,
MarketFSE: cbPhone_CommunityChoice_1.Selected.FSE.DisplayName,
MarketFSEmail: cbPhone_CommunityChoice_1.Selected.'FSE Mail'
}
);
//Retrieve new market printers if market has changed
Set(
varMarketName,
First(colUserData).MarketName
);
ClearCollect(
colMarketPrinters,
Filter(
'FSEApp-Printers',
Active = true,
Market.Value = varMarketName
)
);
//Set variable if market is utilizing printer list
If(
CountRows(colMarketPrinters) > 0,
Set(
varMarketPrintersExist,
true
),
Set(
varMarketPrintersExist,
false
)
)
);
//Patch UserData with set environmental settings
Patch(
colUserData,
First(colUserData),
{
PhoneBodyFontSize: sliderPhone_BodyFont.Value,
PhoneTitleFontSize: SliderPhone_TitleFont.Value,
PhoneHeaderFontSize: sliderPhone_HeaderFont.Value,
PreferenceTheme: If(
togPhone_Settings_Theme,
"Dark",
"Light"
),
PreferenceMemory: togPhone_Settings_Theme_1,
PreferenceMemoryLength: ddPhone_Yellow_1.Selected.Value
}
);
//Clear stored User Data
ClearData("psuserdata");
//Save User Data
SaveData(
colUserData,
"psuserdata"
);
//Navigate back home
Back(ScreenTransition.UnCover);
//Hide loading/working spinner
UpdateContext({SettingsWorking: false})
)