# Appending list by adding unique identifier to duplicate values

**URL:** <https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132>\
**Category:** Revit\
**Tags:** python\
**Created:** [September 15, 2020, 1:02am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132 "2020-09-15T01:02:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 1:02am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/1 "2020-09-15T01:02:31Z")

</div>

Hi all,

I’m a long time lurker, and this forum has been fundamental to getting me into Dynamo. Thank you to all who participate.

I’m creating a script to label all my interior elevations once created with the room number and orientation, i.e. 101N. I thought I had it until I realized that my list of view names has the possibility of duplicates, and, as we all know, no duplicate view names.

Normally I can power through an issue like this, but I’m having trouble even conceptualizing how to solve this. What I need is: I have a list of values (room names) [101N, 101E, 101S…110N…] but for any duplicates, I need to append my list _from_ [**101N, 101N, 101N,** 101E, 101S] _to_ [**101N, 101N\_1** , **101N\_2** , 101E, 101S]. Some obvious constraints- I need the list to remain the same length, and it has to stay in the same order.

I can’t figure out how to step through a list and append duplicate values by adding a unique identifier (\_1, \_2). Any advice would be greatly appreciated. Thanks again to the forum as a whole!!

 ![Screenshot 2020-09-14 201149](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/d/ddcb5d88923bc735000fc6b97cb9dd1770d88e71.jpeg)

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 1:58am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/2 "2020-09-15T01:58:40Z")

</div>

Is your parameter for [101N, 101S… etc] is “Name” in the properties?

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 2:20am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/3 "2020-09-15T02:20:51Z")

</div>

I’m ultimately feeding this into ‘Element.SetParameterByName’ with ‘element’ being my list of views and ‘parameterName’ being “View Name”. Hope that helps. 😬

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 2:29am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/4 "2020-09-15T02:29:01Z")

</div>

hi,

something like this [duplicate\_room\_names.dyn](https://forum.dynamobim.com/uploads/short-url/phh3hnR7cYD5SxXyt1O5kJtSPLb.dyn) (6.2 KB)

 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/6/464b91dd84d1d6b65783d9359594a3c68dda8e49.png)  
 ![2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/a/8a07337f61aae08b17f586e24196503f8de35e6c.png)

 ![3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/f/bfd2a30329494392b007f8094b6fca5414a50f1b.png)

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 2:55am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/5 "2020-09-15T02:55:23Z")

</div>

Oh my gosh!!!

I’m pulling my hair out because you’ve nailed the result I want but I cant figure out how you got it!!

Would it help to say that what I would like to feed into the Python script is a full list of names, as strings (101N, 101N, 101E) and a list of (I’m assuming) list of unique names(also strings)?? (101N, 101E), with the output being as you’ve already achieved (101N, 101N\_1, 101E)??

Thank you so much for your time already. Truly appreciative!! 🙏

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 2:56am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/6 "2020-09-15T02:56:16Z")

</div>

Please dont forget to mark my post as the solution to your problem. 🙂

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 2:57am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/7 "2020-09-15T02:57:29Z")

</div>

I will have my lunch, please wait a minute

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 3:09am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/8 "2020-09-15T03:09:40Z")

</div>

Here is your second request [duplicate\_names.dyn](https://forum.dynamobim.com/uploads/short-url/u474p63tHvz2LFIKV4KpOeXnaCl.dyn) (3.6 KB)

 ![4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/2/025b66788f272fa9d1d437a9d92b5238200dbd70.png)

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 3:21am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/9 "2020-09-15T03:21:13Z")

</div>

Both humbled, and irritated I am not at this level of coding. Thank you so much for your help.

Last question- is it possible to maintain original list order? As to match ‘views’ with the names I am feeding into ‘SetParameterByName’? It appears your script is alphabetizing the results…

 ![Screenshot 2020-09-14 211516](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/b/3bffdf8f365f8e1602735b794c390c8dcacea660.jpeg)

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 3:42am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/10 "2020-09-15T03:42:57Z")

</div>

please check this [duplicate\_room\_names.dyn](https://forum.dynamobim.com/uploads/short-url/eFJDPMNDdJEdNju09EFzVx7U8EY.dyn) (9.1 KB)

 ![5](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/f/dfb3cab85029a76a2b8a55521db3f3e09bdedc82.png)

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 3:45am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/11 "2020-09-15T03:45:25Z")

</div>

> [@blsalvio](#):
>
> Please dont forget to mark my post as the solution to your problem. 🙂

I already solve your 3 requests.

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 4:01am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/12 "2020-09-15T04:01:33Z")

</div>

I’m trying desperately to make your Python script match what I’ve got, but I’m having trouble matching your IN[0] and IN[1] variables, or lists. I see you are inputting as rooms, but I am trying to input as strings.

I am currently trying to make what you have provided work to achieve my goal.

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [September 15, 2020, 4:07am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/13 "2020-09-15T04:07:43Z")

</div>

> [@jweber](#):
>
> I can’t figure out how to step through a list and append duplicate values by adding a unique identifier

 ![roomNames1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/3/834bfe18817a82b9c963297c23c06f66d8265a8f.png)  
 ![roomNumbers_2020-09-15_09-34-57](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/5/05fd67b3fe98a61e8eab305862371549c9e57599.png)  
[roomNumbers.dyn](https://forum.dynamobim.com/uploads/short-url/riLWe7TtyHWXru9dN9voNY3Tw9W.dyn) (21.9 KB)  
 ![roomNames2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/9/b954de67436bc9d6ec41de9cc6866fc7d1345e36.png)

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 4:19am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/14 "2020-09-15T04:19:11Z")

</div>

please check this [duplicate\_room\_names.dyn](https://forum.dynamobim.com/uploads/short-url/WgvkIqV2fDwKBbyyT4koX3WITM.dyn) (7.5 KB)

![6](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/7/87f97a675bb73dbd90dda93aa75b8ac704f44898.png)

put in IN[0] your rooms, in IN[1] your strings and in IN[2] the parameter where the name resides.

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 4:30am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/15 "2020-09-15T04:30:47Z")

</div>

I’m not sure how we got spun out on changing room names-

I am trying to rename _views_, but at it’s core, I have a list of string values, [101N, 101N, 101N, 101E, 101S] that I am trying to append to [101N, 101N\_1, 101N\_2, 101E, 101S].

Contained within the help provided, I can probably figure it out, but I’m having a hard time reverse engineering the Rooms back strings. Bare with me 🤦‍♂️, and again, I am super appreciative of any help, thank you!!!

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [September 15, 2020, 4:34am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/16 "2020-09-15T04:34:33Z")

</div>

> [@jweber](#):
>
> I’m not sure how we got spun out on changing room names-
> 
> I am trying to rename _views_ , but at it’s core, I have a list of string values

 ![viewNames_2020-09-15_10-03-41](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/d/8d7ce8e4146007b6bed965cc429f2669ecd4b282.png)  
[viewNames.dyn](https://forum.dynamobim.com/uploads/short-url/fQzDPDgSfyeMPQyK90YOXnl7VuE.dyn) (29.5 KB)

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 4:50am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/17 "2020-09-15T04:50:04Z")

</div>

Vikram,

Absolutely thrilled to have you respond. Any time I am searching for a solution and see your responses, I know I’m getting closer!!

This did it. I will clean up and post a full .dyn to help others. Thank you for helping me through this final hurdle today!! You are a magician!

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 4:51am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/18 "2020-09-15T04:51:37Z")

</div>

hi try this [duplicate\_names.dyn](https://forum.dynamobim.com/uploads/short-url/2z9sexav3jewnpQ3eRnLR8xH7D.dyn) (3.8 KB)

![7](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/c/bc798c5f7406be6ca65392b8cfdf813f62690a8b.png)

---

<div class="post-metadata">

**Author:** ![jweber](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jweber](https://forum.dynamobim.com/u/jweber)\
**Post date:** [September 15, 2020, 4:52am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/19 "2020-09-15T04:52:21Z")

</div>

Thank you very much for helping. It was my undoing that I could not follow your Python.

Thank you again, I am very thankful for your time and help.

---

<div class="post-metadata">

**Author:** ![blsalvio](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@blsalvio](https://forum.dynamobim.com/u/blsalvio)\
**Post date:** [September 15, 2020, 4:56am UTC](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132/20 "2020-09-15T04:56:03Z")

</div>

Ok no problem. Sorry I cannot figure out what you want to do.

[Next page](https://forum.dynamobim.com/t/appending-list-by-adding-unique-identifier-to-duplicate-values/55132.md?page=2)
