ChangesetReader and multiple changes. #9441
-
|
I am using this to process the changes to my iModel that happen when using PlantSight or OPPID. using reader = ChangesetReader.openGroup({ changesetFiles: changeSetFiles, db: iModelDB, propFilter:PropertyFilter.All,rowOptions:{classIdsToClassNames:true}});
reader.setOpCodeFilters(new Set(["Deleted", "Updated", "Inserted"]));
using pcu = new PartialChangeUnifier(ChangeUnifierCache.createInMemoryCache());
while (reader.step()) {
pcu.appendFrom(reader);
}
var processedCounter = 0;
var changeCollection: any[] = [];
for (const instance of pcu.instances) {
Logger.logInfo(loggerCategory, "Instance :" + instance);
var cname = instance.ECClassId;
if (cname.startsWith("ProcessFunctional")) {
var changeItemInfo = new ChangeItemInfo(instance.ECInstanceId, cname, instance.$meta.op, instance.FederationGuid, instance.CodeValue, "");
if(undefined === changeCollection.find((item:ChangeItemInfo)=> item.equals(changeItemInfo)))
changeCollection.push(changeItemInfo);
}
processedCounter++;
}I need to update our internal data based on the cloud model. When the user creates a component, commits that change. Then deletes that same component and commits that change. Then I "sync" my side by building a changeset that has the two commits. What I am seeing is the first time I process the set I see the new component only and the second time I process the same set I only see the deleted component. Is there something that I can do to avoid this issue? Since I get updates on a 10 minute timer and there could be any number of changes that happen in this window. Any thoughts or suggestions? Mark Anderson |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
I did not understand the scenario completely. Would love to connect with you and help you out more. Lets say we add the component and create a changeset file for the change, that changeset file may include INSERT ops in 2 - 3 tables and then when we will delete the component and create another changeset file, that changeset file will include DELETE ops in the same 2 - 3 tables. Now when we open the changeset files as a group, we on the native side squash the changes(that is the behavior of changesets in We can discuss about the exact problem you are facing more over on teams(or here) and figure out a way forward. |
Beta Was this translation helpful? Give feedback.
It is working as expected INSERT + DELETED = NOOP .Added a test