Doubles in list

Hey
I have a list, and every time the same name is multiple times, i want to get a number behind it.
Any idea on how that can happen??

Thanks
Nichlas

Start by looking at groupbykey and count nodes :slight_smile:

Maybe you want to do something like this? I’m not sure why you are trying to add numbers in your original example (I don’t know what X, Y, Z, and V represent). If you have a list of values and you want to count the number of each unique value in the list, first you need to figure out how many unique values there are, and how many of each exist. Here’s one way to do it.

Joe

this?
3

The ways give a number on every name in the list. What i need is, those to with the name, example " Work_Snit" i want to name “Work_Snit_1” and “Work_Snit_2”. But i also need them to get back ind the same order as you see in the list.

It’s about my view names, so just ignore the X, Y, Z and V letters, it’s just my dynamo structure.

Maybe this is want you want.

Yes, it’s exactly what i want.
But i can’t get it to work, can you help??
Udklip

Use “Flatten” in my script not"List.Flatten".
Also you can revise your script as shown to get the same result.

Hey.
I can’t get the first part of the script to work. Can you see why?? :slightly_smiling_face:
Udklip2

If you see nulls inside your list, that usually means you have a problem either with that node or somewhere before it. Traceback where the nulls come from and that can usually solve your errors.

In this case, you have a null at index 4 in your X + B + Y + Z + V; line. Look at the inputs to that codeblock and find out why, because that null is giving you the error at List.AllIndicesOf.

The first “null” is not a problem in code block, but it’s shouldn’t affect the other items of the list in the “Allindicesoff” node.

If the null isn’t a problem, then you should clean your lists and remove the null.

As nulls do affect AllIndicesOf node:

1 Like

Hey.
windzxy:
Can you show what your script nodes says, i can’t figure out where the mistake is.
I cant find the node from Clockwork, but dynamo have one, i think does the same.
Even when i sort out all “null”.

The node from Clockwork is not the same as dynamo.
The one in dynamo can not replace all items in one list.
The capture could help you to understand the difference.

Also you both are using very different versions of Dynamo, which also means your OOTB nodes and clockwork are different versions.

Thank you @kennyb6.
I rerun the script as below.


@1065553 You can download the script and the node from Clockwork to try it again.
Doubles in list.dyn (13.4 KB)
List.ReplaceItemAtIndex.dyf (4.0 KB)

2 Likes

Thanks a lot, i got it to work, and it’s exactly the way i wanted it. :slight_smile: