web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : Uhl5QNz210zoCTi+cTrLud
Power Apps - Building Power Apps
Unanswered

Offline Powerapps-Sync issue

Like (0) ShareShare
ReportReport
Posted on 8 May 2021 02:21:20 by 220

Hello, I am trying to add an offline functionality in my app. The code is buggy, sometimes it works and sometime it does not. I am seeking your help in this. Below is my code on submit button.

If(
 Connection.Connected ,
Patch(
 'Dev_Data.RecordOut',
 Defaults('Dev_Data.RecordOut'),
 {
 Asset: Dropdown1_2.Selected.Asset,
 AssetLocationFrom: drpFrom.Selected.AssetLocation,
 AssetLocationTo: drpTo.Selected.AssetLocation,
 ByResource: drpByResource.Selected.LabourerName,
 ID: Last('Dev_Data.RecordOut').ID + 1,
 ReturnDate: dteReturn.SelectedDate
 }
);
Refresh('Dev_Data.RecordOut');
ClearCollect(LocalIssues,'Dev_Data.RecordOut');
SaveData(LocalIssues,"offlineissues"),

Collect(localchanges,
{Asset: Dropdown1_2.Selected.Asset,
 AssetLocationFrom: drpFrom.Selected.AssetLocation,
 AssetLocationTo: drpTo.Selected.AssetLocation,
 ByResource: drpByResource.Selected.LabourerName,
 ID: Last(localchanges).ID + 1,
 ReturnDate: dteReturn.SelectedDate,
 ChangeType : "a"});
 SaveData(localchanges,"offlinechanges");
 
 UpdateContext({popup:true}))
 
 
 
 

and this is the code in the timer on end.

If(
 Connection.Connected && CountRows(localchanges) > 0,
 ForAll(
 localchanges,
 If(
 ChangeType = "a",
 Patch(
 'Dev_Data.RecordOut',
 Defaults('Dev_Data.RecordOut'), 
 {
 Asset: Dropdown1_2.Selected.Asset,
 AssetLocationFrom: drpFrom.Selected.AssetLocation,
 AssetLocationTo: drpTo.Selected.AssetLocation,
 ByResource: drpByResource.Selected.LabourerName,
 ID: Last('Dev_Data.RecordOut').ID +1 ,
 ReturnDate: dteReturn.SelectedDate
 }
 )
 )
 )
);
Clear(localchanges);
Refresh('Dev_Data.RecordOut');
ClearCollect(
 LocalIssues,
 'Dev_Data.RecordOut'
);
SaveData(
 LocalIssues,
 "offlineissues"
)

 

 

 

The data collected offline does not sync all the time, but sometimes it does. My doubt is with the ID column in the source.

Also, the datasource I have is MySql.

 

Please suggest. thanks in advance.

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete