Find object duplicates comparing only not-empty values

1
There is an entity “product”, it has associations with many other entities like “category’, ‘’type”, “group”, etc. so when I crete a new product, I use reference selector dropdowns to select them. I need to run a microflow on a button click, that would check if there is any duplicate (another product with identical combination of ctegory, type, group etc.) in the database. But the microflow should compare only selected attributes. So if i didn’t select “type”, for example, in the dropdown, it should not take it into account when finding duplicates.   I was thinkig to use a simple retrieve action with xpath expression to find a duplicate. But how can it be done if some attributes should be not taken into account if empty? If-else statememnts for XPath? Or some other solution?
asked
1 answers
0

I would implement multiple retrieves;

Reference to category + value

Type + value

etc...

Because I can imagine that you want to provide the user with feedback like this product for Type X already exists or for category X etc. When having a single retrieve with all possible options you only know that there is a duplicate for one or more of the combinations, but you don’t know which.

 

====EDIT with new idea====

If the full combination Product name? + type, group & category should be unique (not already exists in the database) a single retrieve will do the trick.

See my example below where I compare the reference between the product and the type, group, category. If it references the same object.

If referencing the same object, the product will be returned.

if referencing a different object, nothing is returned.

if not referencing a object, object will be returned if also not referencing a object.

 

 

answered