# Zero-Touch MultiReturn adds new level to OUT list

**URL:** <https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816>\
**Category:** Developers\
**Tags:** revit, zerotouch\
**Created:** [October 30, 2018, 4:09am UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816 "2018-10-30T04:09:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [October 30, 2018, 4:09am UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/1 "2018-10-30T04:09:02Z")

</div>

Hi All,

I’ve created a zero-touch node that multiplies each number of the incoming list of lists by 2.  
The resulting list has an extra rank (even if the rank node says it doesn’t)

any ideas why? how do I output a list of lists similar to the flatten node one?  
I’m using the `MultiReturn` so I can change the name of the output port (unless there is another way)

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

```
[MultiReturn(new[] { "out" })]
public static Dictionary<string, object> test (List<List<double>> data)
{

foreach (var lst in data)
{
for (int i = 0; i < lst.Count; i++)
{
lst[i] *= 2;
}
			
}

return new Dictionary<string, object>
{
{"out", data }
};

}
```

---

<div class="post-metadata">

**Author:** ![jean](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jean/32/188752_2.png) [@jean](https://forum.dynamobim.com/u/jean)\
**Post date:** [October 30, 2018, 5:33am UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/2 "2018-10-30T05:33:29Z")

</div>

hi @salvatoredragotta, try this way;

First, create a new list for your return value and another list for sub-list.

```
// return result
var myData = new List<List<double>>();
foreach (var lst in data)
{ 
    // sub-list for inner list
    var subList = new List<dobule>();

    for (int i = 0; i < lst.Count; i++)
    {
           double res = lst[i] * 2;
           subList.Add(res);
    }
    myData.Add(subList);
}
return myData;

```

\*Note: your method statement (public …) still need to write, of course.

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [October 30, 2018, 10:41pm UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/3 "2018-10-30T22:41:41Z")

</div>

> [@jean](#):
>
> hi @salvatoredragotta, try this way;
> 
> First, create a new list for your return value and another list for sub-list.
> 
> ```auto
> // return result
> 
> ```

@jean you are not using the `[MultiReturn(new[] { "out" })]` in your code.

I tried this but it doesn’t work

```
		[MultiReturn(new[] { "out" })]
		public static Dictionary<string, object> test3(List<List<double>> data)
		{

			var myData = new List<List<double>>();
			foreach (var lst in data)
			{
				// sub-list for inner list
				var subList = new List<double>();

				for (int i = 0; i < lst.Count; i++)
				{
					double res = lst[i] * 2;
					subList.Add(res);
				}
				myData.Add(subList);
			}
			return new Dictionary<string, object>
			{
				{"out", myData }
			};
		}

```

how to keep the structure of original list of lists.For Example, look at the List.Replace node in the [orchid package](https://github.com/erfajo/OrchidForDynamo)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/4/34d221a134233a9bcdc5687de755d70c025a0a7b.png)

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [October 30, 2018, 11:03pm UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/4 "2018-10-30T23:03:59Z")

</div>

@salvatoredragotta you dont need to use a dictionary to return a single output. It explains why you are seeing the additional rank; dictionaries are key value pairs, so if you use them to output your values, the extra rank is needed to store these pairs.

Just return your list and change your methods return type accordingly:

```
	public static List<List<double>> test3(List<List<double>> data)
	{

		var myData = new List<List<double>>();
		foreach (var lst in data)
		{
			// sub-list for inner list
			var subList = new List<double>();

			for (int i = 0; i < lst.Count; i++)
			{
				double res = lst[i] * 2;
				subList.Add(res);
			}
			myData.Add(subList);
		}
		return myData;
	}

```

Edit: looks like @jean already gave you the answer!

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [October 30, 2018, 11:07pm UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/5 "2018-10-30T23:07:43Z")

</div>

> [@Thomas\_Mahon](#):
>
> you dont need to use a dictionary to return a single output.

@Thomas_Mahon I want to have a control on the name of the single output port. is there another way?

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [October 30, 2018, 11:10pm UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/6 "2018-10-30T23:10:32Z")

</div>

Do you mean the label of the output port of the node, or the key name in the pop-up watch window from below the node?

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [October 30, 2018, 11:16pm UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/7 "2018-10-30T23:16:32Z")

</div>

@Thomas_Mahon

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

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [October 31, 2018, 12:40am UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/9 "2018-10-31T00:40:52Z")

</div>

@salvatoredragotta you simply need to add an XML documentation file to your build output. In VS click Project \> Properties, click the Build tab then check the XML Documentation File setting.

Now add the XML tags above any public class members. If you triple forward slash above the member, you will automatically generate the necessary tags. To rename your output ports, use the `returns name` tag:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/3/83137d3d96be833517376efe3f817ef9cc508b1d.png)

@erfajo method to name output ports will only work if you develop nodes using Dynamo’s NodeModel, whereas Zero Touch uses XML tags.

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [October 31, 2018, 3:42am UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/10 "2018-10-31T03:42:30Z")

</div>

> [@erfajo](#):
>
> You can see the structure I use in my DynamoSamples

Thanks @erfajo! I managed to achieve what I wanted following your examples. Thank you for sharing!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/7/579f2647fa2d4075ae7b3fcb9f6b2b12b5fdb692.png)

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [October 31, 2018, 4:03am UTC](https://forum.dynamobim.com/t/zero-touch-multireturn-adds-new-level-to-out-list/27816/11 "2018-10-31T04:03:45Z")

</div>

> [@Thomas\_Mahon](#):
>
> you simply need to add an XML documentation file to your build output. In VS click Project \> Properties, click the Build tab then check the XML Documentation File setting.

@Thomas_Mahon I’ve already done that. The issue is getting the correct data structure with `[MultiReturn(new[] { "out" })]` with just one output port. is it achievable or @erfajo suggestion is the only solution?
