Catch Duplicates in a lists

I’m trying to filter edge cases before feeding a list of walls to a custom node, mainly blanks and duplicates. I’m catching the blanks and replacing them with an appropriate error message. I’ve tried using Lists.DuplicateItemIndicies, but it’s picking up the blanks too. You can see in the middle where I branched up with some experiments, but I feel like I might be making it more complicated than it needs to be. In my sample I changed Wall D02 to another D01, hoping it’d catch the repeat and alert the operator. Any suggestions?

duplicates.dyn (90.3 KB)

Elements usually aren’t directly comparable. Are you comparing the elements for duplicates or a specific parameter value? (I can’t zoom in your image for some reason so it’s hard to tell what’s going on.) If you need to compare the element then I’d recommend converting the ElementId to an integer and comparing those.

Do you want to remove the duplicates or just flag them? Also, does list order matter? Maintaining order likely means dealing with indices. If order doesn’t matter you can sort and filter much easier.

I took a pic from the workspace, maybe that’ll have more resolution, I just couldn’t pin the returns open that way. Indices probably will be important, because I’m trying to match the error message back to which wall, it’s comparing a parameter called 'Mark`.

What is your next step though? Why is order important after determining blank and duplicate items? What are you going to do with them?

Your image is still illegible by the way. Use the export image feature like you did, but make sure you’re zoomed in close enough that the node titles are visible. You don’t have to have everything on the page, it just needs to be zoomed in. You can also still have the node previews pinned, which is highly recommended so we can actually see what’s happening.

The next step would replace index 4 and maybe 3 with the error message indicating that it’s a duplicate. Then it feeds into John Pierson’s example of error messages last weekend as the fourth argument, but if it gets to the list that’s far enough for now, The next section works fine already.

You already have the unique and duplicate indices in the top group so what exactly are you stuck on now?

@Nick_Boyts it’s mixing in the ones that are blank, so I need a way to separate blanks from duplicates because they get a different error message

Maybe this focuses on the core of it
I have a few blanks, but like you said those are identified already… so how do I separate the 2 Deltas?
duplicatesFilterByItself.dyn (31.4 KB)

That’s why I was asking if order is important. It would be really easy to separate the blanks right away and deal with the separately. If you need to maintain the exact original order it gets a little more complicate.

In order to maintain the original order you need to use a nested condition similar to this:


ok, I think I can make that work… brb

a lot cleaner than the hole I was digging this morning.

1 Like