# Getting OutPort Data from nodes in API

**URL:** <https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501>\
**Category:** Developers\
**Created:** [April 3, 2021, 7:02pm UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501 "2021-04-03T19:02:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaialcan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jaialcan/32/114853_2.png) [@jaialcan](https://forum.dynamobim.com/u/jaialcan)\
**Post date:** [April 3, 2021, 7:02pm UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/1 "2021-04-03T19:02:15Z")

</div>

Hi all,

UPDATE\* I am trying to get the set data of the input nodes in my workspace through the following code;

```
internal EngineController engine { get; set; }
public List<string> typologyList { get; set; }

public List<string> Typology43()
    {

        typologyList = new List<string>();
        

        foreach (Dynamo.Graph.Nodes.NodeModel node in readyParams.CurrentWorkspaceModel.Nodes)
        {
            
            if (node.IsSetAsInput)
            {
                var startIndex = node.OutPorts[0].Connectors[0].Start.Index;
                var startId = node.GetAstIdentifierForOutputIndex(startIndex).Name;

                var startMirror = engine.GetMirror(startId); 

                object start = null;

                start = startMirror.GetData().Data;

                string estasi = start.ToString();
                typologyList.Add(estasi);
            }
        }
        
        return typologyList;
    }

```

This is then taken to a method and called from Xaml;

```
public List<string> TypologyTypesv2
    {
        get
        {

            List<string> output2 = Typology43();

            return output2;
        }

    }

```

I followed the guidelines from [How To Create Your Own Nodes · DynamoDS/Dynamo Wiki · GitHub](https://github.com/DynamoDS/Dynamo/wiki/How-To-Create-Your-Own-Nodes) but I just don´t get my xaml to populate the list of set values of those nodes while it is working with other properties.

Any idea why? I would appreciate your help.

Thanks  
Jaime

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [April 3, 2021, 7:43pm UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/2 "2021-04-03T19:43:59Z")

</div>

Is the double colon messing it up?

> [@jaialcan](#):
>
> `var startMirror = engine.GetMirror(startId); ;`

---

<div class="post-metadata">

**Author:** ![jaialcan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jaialcan/32/114853_2.png) [@jaialcan](https://forum.dynamobim.com/u/jaialcan)\
**Post date:** [April 3, 2021, 8:16pm UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/3 "2021-04-03T20:16:34Z")

</div>

I double checked and retested without the double colon, but it is not working without that error. Updated the code above with more information.

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [April 3, 2021, 8:34pm UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/4 "2021-04-03T20:34:24Z")

</div>

> [@jaialcan](#):
>
> `var startId = node.GetAstIdentifierForOutputIndex(startIndex).Name`

Is there a typo here? GetAs(t)Identifier…

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [April 3, 2021, 8:35pm UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/5 "2021-04-03T20:35:19Z")

</div>

why are you using get mirror?

If it works for your use case, it will be probably be simpler to just get the inputData from those input nodes - unfortunately not all input nodes support this type - but it might work depending on your use case:  
[Dynamo/NodeModel.cs at master · DynamoDS/Dynamo (github.com)](https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCore/Graph/Nodes/NodeModel.cs#L909)  
InputData will contain some values depending on node type.

Also - about the xaml… no idea since we can’t see your xaml, or the binding you are creating - atleast I guess thats what you’re doing - you may also need to implement INotifyPropertyChanged - read about that interface and wpf bindings.

---

<div class="post-metadata">

**Author:** ![jaialcan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jaialcan/32/114853_2.png) [@jaialcan](https://forum.dynamobim.com/u/jaialcan)\
**Post date:** [April 4, 2021, 5:47am UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/6 "2021-04-04T05:47:05Z")

</div>

Thanks @Michael_Kirschner2 and @SeanP !

Mmm, I rechecked the method and GetAstIdentifierForOutputIndex should be fine.

I tried with InputData property of the nodes, but still I don´t get it working;

```
public List<string> Typology43()
    {

        typologyList = new List<string>();
        

        foreach (Dynamo.Graph.Nodes.NodeModel node in readyParams.CurrentWorkspaceModel.Nodes)
        {
            
            if (node.IsSetAsInput)
            {
                
                string estasi = node.InputData.ToString();
                typologyList.Add(estasi);
            }
        }
        
        return typologyList;
    }
[JsonIgnore]
    public virtual NodeInputData InputData
    {
        get { return null; }
    }

```

As the value I would like from the nodes is the OutputData as well as the possible options of the nodes, in dropdowns for instance.

 ![Captura](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/0/00a1a111e8de9c122e0725a815a21f7601ad4df0.png)

I gave it a try to OutputData as well but after defining methods and variables I get a few errors that I don´t find a workaround;  
1.- “SampleWindowViewModel.GUID” : no suitable method to override  
2.- The name Properties does not exist in the current context.(I cannot find where it is defined in the link you sent above)  
3.- “NotificationObject” does not contain a definition for “GUID”

Thank you

---

<div class="post-metadata">

**Author:** ![jaialcan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jaialcan/32/114853_2.png) [@jaialcan](https://forum.dynamobim.com/u/jaialcan)\
**Post date:** [April 4, 2021, 7:57am UTC](https://forum.dynamobim.com/t/getting-outport-data-from-nodes-in-api/62501/7 "2021-04-04T07:57:46Z")

</div>

I finally got it! The code I used to create the string is;

```
string estasi = node.OutputData.InitialValue;

```

Nonetheless, there are some nodes that are passing an empty value such as Revit.Selection.Categories and similar. Is there any work around to get these set values as well?
