# Combining lists' values to new list

**URL:** <https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124>\
**Category:** Lists-Logic\
**Created:** [January 25, 2017, 12:01pm UTC](https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124 "2017-01-25T12:01:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![3Pinter](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/3pinter/32/74327_2.png) [@3Pinter](https://forum.dynamobim.com/u/3Pinter)\
**Post date:** [January 25, 2017, 12:01pm UTC](https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124/1 "2017-01-25T12:01:40Z")

</div>

I have 2 lists and I’d like to combine those values into a new same length list.

list 1:  
400  
500  
600

list 2:  
120  
140  
160

separator: “x”  
new list:  
400x120  
500x140  
600x160

I thought list.cartesianProduct should do that, but I get ‘null’ …

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

---

<div class="post-metadata">

**Author:** ![T\_Pover](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t_pover/32/19147_2.png) [@T\_Pover](https://forum.dynamobim.com/u/T_Pover)\
**Post date:** [January 25, 2017, 12:07pm UTC](https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124/2 "2017-01-25T12:07:28Z")

</div>

It’s easier than you might think, you just need to first convert from an int to a string, after that you can concatenate like this:

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/1/c11dfe3016ed13bd04efbfbe887a3c770f8cf399.jpg)

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [January 25, 2017, 12:07pm UTC](https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124/3 "2017-01-25T12:07:49Z")

</div>

Type this in a code block:

**a+“x”+b;**

and plug your inputs in…

OK, too late 😏

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/c/9/c999f5e424296fdfe2d6f25ea87ed97946491ed9.JPG)

Please see also here:  
[http://dynamoprimer.com/en/07\_Code-Block/7-3\_shorthand.html](http://dynamoprimer.com/en/07_Code-Block/7-3_shorthand.html)

---

<div class="post-metadata">

**Author:** ![3Pinter](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/3pinter/32/74327_2.png) [@3Pinter](https://forum.dynamobim.com/u/3Pinter)\
**Post date:** [January 25, 2017, 12:19pm UTC](https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124/4 "2017-01-25T12:19:49Z")

</div>

Thanks both of you!

Yna you got ninja’d 😁

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [January 25, 2017, 8:56pm UTC](https://forum.dynamobim.com/t/combining-lists-values-to-new-list/9124/5 "2017-01-25T20:56:10Z")

</div>

The String.Join should have been the obvious choice here, but it acts different than most other nodes. It joins the strings in each sublist when you normally would expect it to combine the two lists. To make it work in this case, you have would have to transpose the list or use List.Combine:

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