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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Tree Widget in Mashup Cannot Display Network Properly

KC_9771425
5-Regular Member

Tree Widget in Mashup Cannot Display Network Properly

Hello everyone,

 

I have created a network and it looks properly under Network Hierarchy tab. Then I bind the Network data to Tree Widget via GetNetworkConnectionsWithTemplate service. When I hit view mashup it displays some nodes in wrong places. The configuration of Tree Widget is as follows:

IDField: to,

LabelField: to,

ParentIDField: from,

TooltipField: to,

ValueField: to

and rest of them are default.

I'm not sure if my configuration is wrong or the widget has a bug. 

I'm attaching some screenshots to help you to understand.

 

Best,

Kaan

1 ACCEPTED SOLUTION

Accepted Solutions

@KC_9771425,

 

While creating a Network from the Composer Network UI I believe same sub-node cannot be added to different main nodes. I believe doing so programmatically technically works but is an unsupported scenario hence my previous question of whether you created this Network programmatically. 

View solution in original post

8 REPLIES 8

Hi @KC_9771425,

 

Am I seeing correctly that you are displaying some entities several times in the Network ? Which ones are ThingTemplates ?

Could you also share the version of ThingWorx you are using ?

 

Thanks !

KC_9771425
5-Regular Member
(To:c_lowy)

Not me but tree displays duplicate entities. I want to display them as in Network Hierarchy. You can see that in the first attachment. All entities in my network are things. My current Thingworx version is 9.1

 

Best,

Kaan

Did you create this Network programmatically using the CreateNetwork API ?

KC_9771425
5-Regular Member
(To:c_lowy)

Yes, I beleive so. It looks proper in the Network Hierarchy. You can examine my code that generates all the things and the network.

 

var thing1 = {

thingTemplateName: "RegionTT"/* THINGTEMPLATENAME */,
name: "Region-1" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing1);

var thing2 = {

thingTemplateName: "RegionTT"/* THINGTEMPLATENAME */,
name: "Region-2" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing2);

var thing3 = {

thingTemplateName: "SiteTT"/* THINGTEMPLATENAME */,
name: "Site-1" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing3);

var thing4 = {

thingTemplateName: "SiteTT"/* THINGTEMPLATENAME */,
name: "Site-2" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing4);

var thing5 = {

thingTemplateName: "SiteTT"/* THINGTEMPLATENAME */,
name: "Site-3" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing5);

var thing6 = {

thingTemplateName: "SiteTT"/* THINGTEMPLATENAME */,
name: "Site-4" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing6);

var thing7 = {

thingTemplateName: "SiteTT"/* THINGTEMPLATENAME */,
name: "Site-5" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing7);

var thing8 = {

thingTemplateName: "SiteTT"/* THINGTEMPLATENAME */,
name: "Site-6" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing8);

var thing9 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-1" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing9);

var thing10 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-2" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing10);

var thing11 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-3" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing11);

var thing12 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-4" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing12);

var thing13 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-5" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing13);

var thing14 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-6" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing14);

var thing15 = {

thingTemplateName: "RoomTT"/* THINGTEMPLATENAME */,
name: "Room-7" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing15);

var thing16 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-1" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing16);

var thing17 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-2" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing17);

var thing18 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-3" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing18);

var thing19 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-4" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing19);

var thing20 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-5" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing20);

var thing21 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-6" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing21);

var thing22 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-7" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing22);

var thing23 = {

thingTemplateName: "DeviceTT"/* THINGTEMPLATENAME */,
name: "Device-8" /* STRING */
};

// no return
Resources["EntityServices"].CreateThing(thing23);

var parms = {
infoTableName : "InfoTable",
dataShapeName : "NetworkConnection"
};

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


var result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(parms);

var params = {

name: "Wind3MockNetwork"/* STRING */,
connections: result /* INFOTABLE */
};


// no return
Resources["EntityServices"].CreateNetwork(params);

params = {
to: "Region-1" /* STRING */,
connectionType: "contains" /* STRING */,
from: undefined /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Region-2" /* STRING */,
connectionType: "contains" /* STRING */,
from: undefined /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Site-1" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Region-1" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Site-2" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Region-1" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Site-3" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Region-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Site-4" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Region-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Site-5" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Region-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Site-6" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Region-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-1" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-1" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-2" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-1" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-1" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-2" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-3" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-4" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-3" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-5" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-4" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-6" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-4" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Room-7" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Site-5" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-1" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-1" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-2" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-1" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-3" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-2" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-4" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-3" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-5" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-3" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-6" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-5" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-7" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-5" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

params = {
to: "Device-8" /* STRING */,
connectionType: "contains" /* STRING */,
from: "Room-5" /* STRING */
};

// no return
Networks["Wind3MockNetwork"].AddConnection(params);

@KC_9771425,

 

While creating a Network from the Composer Network UI I believe same sub-node cannot be added to different main nodes. I believe doing so programmatically technically works but is an unsupported scenario hence my previous question of whether you created this Network programmatically. 

@KC_9771425 ,

 

A Thing can only be added to a single network once but a Thing can belong to multiple networks.

 

Thanks,

Hi @KC_9771425,

 

Indeed, as per TravisPickett's post it is not supported to add a Thing to a single Network multiple times. This actually can't be done when you create a Network from the Composer UI. Doing so programmatically is actually not a supported scenario : CreateNetwork service allows the creation of invalid Network structure in ThingWorx.

slangley
23-Emerald II
(To:KC_9771425)

Hi @KC_9771425.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags