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

Display Kepware tag tree in mashup

jensc
17-Peridot

Display Kepware tag tree in mashup

Hello,

 

We have started facing performance issues in one of our mashups where we are displaying the complete kepware tags list of one of our industrial connections.

 

Or well, it is not so much of an issue to disaplay the tags, however, creating the hierarchy of the tags is.

 

To do this, we currently use the existing services on the industrial connection (BrowseItems and BrowseGroups) and then add the hierarchy to a datatable.

 

We do this because it is much faster to fetch the hierarchy from a datatable than to run the service that "creates" the structure each time the mashup is refreshed.

 

Now to the issue at hand.

 

Some of our industrial connections have a lot of tags. Even with our "work around", we are timing out in our service where we add the tags to our datatable.

So I wanted to check with the community to see if anyone knows a different way of doing this?

 

I can see when using the "Discover" tab in the composer that the tree grid uses the "BrowseGroups" service to fetch each level separately instead of fetching all data directly. But we can not do the same in our mashup grid can we? (Twx 9.3)

 

Is there perhaps some API on the kepware server we could use to fetch the entire tag hierarchy?

 

I hope I can get some great feedback!

 

Thanks,

Jens

ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To:jensc)

Hello,

 

Just in case anyone ends up looking at this post for inspiration:

We didn't end up using the async services as there was no way of ensuring a unique ID that is required when building a tree structure.

Instead we used a subscription for this so that we could ensure a unique ID, AND still get somewhat async functionality. Or in any case avoid timeouts.

 

For anyone that is curious, here are the services and properties used:

 

The properties used:

jensc_0-1687413794971.png

The subscription:

jensc_1-1687413837902.png

The service used to trigger the subscription to start:

jensc_2-1687413876520.png

The service that is run by the subscription. This doesn't show the recursive part, but basically it is just going over each level of the "root" node.

jensc_3-1687414009661.png

 

Hope this helps someone else.

 

Regards,

Jens

View solution in original post

3 REPLIES 3
DanZ
15-Moonstone
(To:jensc)

I am thinking about two approaches:

 

The first one is a bit of a hybrid of the solution that you have already in place (persisting the hierarchy in a data table) and retrieving the data directly from the industrial connection thing when needed. Depending on the hierarchy depth you can just persist the first one or two levels of the hierarchy in the data table and then query the deeper levels on demand.

 

The second option would be to stick to your current approach but split up the services for persisting the data. The "main" service is retrieving the top level hierarchy and then calls an asynchronus service that will be executed for each direct child element. Lets say you have 20 folders in the top level, you would now have 20 async threads running in the background. Each thread is now happily adding/updating rows in the data table. To prevent heavy database load, the async services should only do "AddOrUpdateDataTableEntries" requests, when they completely fetched all their data and not row by row.

jensc
17-Peridot
(To:DanZ)

Hello @DanZ,

 

For your first point, I'm not entirely sure how we would trigger the fetching of the lower levels as we don't really have any good event for it...

I whish we could've had the same functionality as they do in the industrial connection where when "opening" a parent, we start fetching its children.

I thought that perhaps the "childData" field could be used for this, but either I do not understand the functionality, or it doesn't work in that way.

 

Your second point is likely the way we will move forward with unless there will come a third option from someone else.

It really seems to be the only way we'll be able to make it work in a good way.

 

I should also note that we were mainly having issues on a platform that has a pretty slow database + it having a lot of tags.

So we would likely not face this issue on all of our platforms. But we need to consider the worst case scenario as well.

 

Thanks,

Jens

jensc
17-Peridot
(To:jensc)

Hello,

 

Just in case anyone ends up looking at this post for inspiration:

We didn't end up using the async services as there was no way of ensuring a unique ID that is required when building a tree structure.

Instead we used a subscription for this so that we could ensure a unique ID, AND still get somewhat async functionality. Or in any case avoid timeouts.

 

For anyone that is curious, here are the services and properties used:

 

The properties used:

jensc_0-1687413794971.png

The subscription:

jensc_1-1687413837902.png

The service used to trigger the subscription to start:

jensc_2-1687413876520.png

The service that is run by the subscription. This doesn't show the recursive part, but basically it is just going over each level of the "root" node.

jensc_3-1687414009661.png

 

Hope this helps someone else.

 

Regards,

Jens

Announcements

Top Tags