1 Reply Latest reply on Jul 27, 2015 8:08 AM by paic RSS
    ashleyg Apprentice

    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

      • Re: Populating Network Trees with InfoTables
        paic Collaborator

        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