Name of a parameter in duplicate

I have a dynamo that gives me the name of the spaces according to the family parameters.

In this code it will give me the associated spaces, how to tell it not to copy the name of the space if it is already registered


Do you have an idea ?

@John if you have an idea im lost for that i try all with UniqueItems, if, != … idk

You can do something like this to track items that have already been added:
image

DesignScript
numbers = [1,1,2,3,3,4];
unique = [];
used = [];
unique_check = [Imperative] {
	for (n in numbers) {
		if (List.Contains(used, n)) {

		}
		else {
			unique = List.AddItemToEnd(n, unique);
			used = List.AddItemToEnd(n, used);
		}
	}

	return unique;
};

https://dictionary.dynamobim.com/#/BuiltIn/Action/SetDifference

1 Like

hello @Nick_Boyts , i try like that but i have :

and i have try that after

but it doesn’t work

I’m just showing you an example of the logic at a base level. You would still need to apply this logic to your data and (more specifically) structure, which has sublists to check.

I should apply this code by index of my list, because if I do list.flatten it will not help me, I have to find how to act inside my lists


like that il good but i have 50 indexe ^^ i need to creat a codeblock to simplify
@Nick_Boyts

You just need to have the main function loop through the sublists like you did in your original post. The only difference would be maintaining the unique list. Are you wanting only unique values within the sublist or for all sublists?

Yes I need my values to be unique per list

Per sublist or the entire list? Like would Space 1 show up at index 0 and index 5 or would index 5 be blank because Space 1 already appeared at index 0?

Per sublist

In that case, why not just use UniqueItems after your function?

because I have to do a flatten for that, but I have to find the same order after because I can have in my sublist several spaces if they are different like that

index 0
1 space 1
2 space 2
3 space 3
index 1
1 space 5
2 space 1
3 space 1

If I use unique item I need to do a list.flatten before otherwise it doesn’t work

You wouldn’t Flatten, you would run it per sublist with list levels.
image

Okay I just figured it out… I’m really not good at it thank you very much thx so much