cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Populating Network Trees with InfoTables

ashleyg
1-Newbie

Populating Network Trees with InfoTables

Hi All

Is it possible to populate network trees only from InfoTables and not using a Network Entity or Things?

The code I have attempted is as follows:

Inputs: Name - STRING.

var params = {

  maxItems: undefined /* NUMBER */

};

// result: INFOTABLE

var connections = Things["TestDataTable"].GetDataTableEntries(params);


var params = {

    infoTableName : "InfoTable",

    dataShapeName : "TestNetworkDataShape"

};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(AtlasCustBooleanDS)

var networkInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

var entry;

var i = 0;

var row = new Object();

var eachRow;

row.from = undefined;

row.to = Name;

row.description = Name;

row.connectionType = "Contains";

networkInfoTable.AddRow(row);

row.from = Name;

for each(entry in connections.rows)

{

    //eachRow = connections.getRow(i);

    if (entry.Name == Name)

    {

          row.description = row.to;

          row.connectionType = "Contains";

          row.Name = Name;

          networkInfoTable.AddRow(row);

    }

    i++;

}

var result = networkInfoTable;

Any feedback/sugestions would be highly appreciated.

Thanks

Ashley

1 REPLY 1
paic
1-Newbie
(To:ashleyg)

Yes this is possible.

Guideline would be a table with to / from relationships where the top node is a to with "" as the from or I believe null might work as well.

I haven't tested this for a while, but it used to also be important to group together all the nodes that share the same from

Top Tags