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

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

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

Top Solution Authors
Top Kudoed Authors
Users online (69,000)