GitHub user gertwieland edited a discussion: Can "Synchronize after merge" be 
used to soft delete records?

[Hop 2.11]
I know that the "Synchronize after merge" step can insert, update and delete 
records based on a "flagfield" it receives from the "Merge rows (diff)" step.

However, we often don't want to delete records in the target table if they were 
deleted in the source table. Instead, we want to "soft delete" the records, ie 
just flag them as deleted. My idea is that we simply leave the flagfield with 
text "deleted".

Here's the logic I built:

Put a filter before the "Sync after merge" step. Only pass records where 
flagfield is "new" or "changed" and perform the corresponding actions.

However, for flagfield "deleted", pass the record to an update step and just 
have it update the existing flagfield to "deleted".

<img width="796" alt="image" 
src="https://github.com/user-attachments/assets/ea23793d-a0f3-4101-8c12-1e9aceb03fdf";
 />


When I put a filter that allows only one incoming record, then all but one show 
correctly with flagfield "deleted"

<img width="152" alt="image" 
src="https://github.com/user-attachments/assets/9fa148cb-8980-4b9d-a02d-837e2b2d9c24";
 />

However, when I remove that filter and I allow all incoming records, then it 
reverts the flag for some records, but not for others.

I would have expected zero records remain as "deleted". But instead, a random 
number of records still shows as deleted. I don't understand why it changed 
only a part of the records.

<img width="155" alt="image" 
src="https://github.com/user-attachments/assets/718cef29-e884-4869-9115-6c0cec112562";
 />



GitHub link: https://github.com/apache/hop/discussions/4989

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to