Classify Items (compare lists)

I’m trying to classify our foundations. They have several parameters to compare and it should at the end define a foundation type.

In the following example, there are 5 lists. I want to compare every list, classify same types and overwrite the Index 0 with the types:

Please need a little help

Are the types pre-defined or are you tying to determine all unique types and assign ones with like parameters to the same type mark?

They are not pre-defined, the Index 0 is empty. The code block with the different types is just for show the result i want to get at the end.

So yes I try to assign the Types to the elements with same parameters.

Kind regards

Try something like List.UniqueItems to get the unique set of sublists then create a dictionary with those types.

Edit: Forgot you’ll have to concat your sublists into single strings in order to use a dictionary, but the general process should still work.

Building off Nick’s suggestion, here’s an example of implementing it:

create types.dyn (33.0 KB)

As Nick mentioned, you have to use an immutable type, like a string, as the keys for your dictionary. I’ve used the String.Join node to achieve that. I’ve also generated the type names by creating a range, starting at 1, based off the uniques list. However, if you run this on multiple files, “Type 1” will most likely be different for each file, since the type names are not determined by the properties themselves.

Very very very nice!!! Thank you a lot!

Kind regards

1 Like