cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FarrellDrafting
Helper II
Helper II

Online/Offline sharepoint backup system creating duplicates.

So I've made an app for a field crew to record quality control conditions, it saves data locally when offline, and uploads when online. it also stores each record locally as a backup if an upload to sharepoint fails or if the record is deleted from the back end.

It works fine if there are no edits made to the record. but if the record is changed, even if the strings its checking are identical, it will push a new duplicate record. See example code below, it runs on a trigger to check the backup data against the sharepoint list.

Collect(
        ElementData,
        Filter(
            ElementDataBackup,
            Not(
                And(
                    Text(ElemQCNum) in ElementData.ElemQCNum,
                    Text(DrillCount) in ElementData.DrillCount,
                    Text(Title) in ElementData.ProjectFullName
                )
            )
        )
    );

does anyone else have a cleaner "upload if record doesn't exist online"? "ElementData" is the online list, "ElementDataBackup" is the local collection. all column names are double checked and correct.

1 REPLY 1
Eelman
Super User
Super User

@FarrellDrafting 

This video by Paul O'Flaherty is a really good explanation of working in offline mode. He uses the 3 things to identify records to be:

- added as new

- modified, and

- deleted

 

For adding new, he leverages the fact there is currently no ID value for a record.

For modifying, he adjusts the Modified Date to 1/1/3001.

For deleting, he adjusts the Modified Date to 1/1/3000.

 

Then using the above he Filters the local collection and updates his SP List accordingly. The video is 1hr 40min but well worth watching

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (30,739)