Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Dear community,
in Thingworx 8.4.4. I am using Collection widget to display machine KPIs in a mashup. The contained mashup is assigned in design time and does not change in runtime. Also the number of items (= machines) is never changing, only the related KPIs. So why do I use collection widget at all? Because this is a template, rolled out to several production facilities. Within one facility the number of machines is constant but it varies between the facilities.
My original approach was to only read the structure when the mashup is loaded. Then every sub-mashup calls a Service to read and refresh the KPIs. With up to 30 and more machines the overhead becomes quite big, instead of once reading data for all machines I am reading the data for each machine one by one. This is not optimal performance wise and only once we checked the Tomcat logs and it was annoying as hell. The next multiplier is the number of users opening the dashboard. My refresh cycle is every 30 seconds, we have >30 machines and for the pilot phase 5 users let's say, that's 150 calls instead of 5 every 30 seconds.
I changed my approach to read the data only once and cascade it into the sub-mashups by Infotable parameters. It works and the network overhead is gone. I am almost happy. Please find attached two screenshots, the "fully rendered" shows an example with 21 machines, blurred because confidential data but I hope you get the idea. The "rendering" screenshot indicates the problem I have, the whole structure is rebuilding with each refresh every 30s. It does make sense as the collection widget does not know how many items it will receive, it's built to be dynamic but I don't need and don't want it in my case.
Long story short: Can I read the data only once per refresh without the collection widget rerendering every time?
I hope I am clear, let me know if you have questions. Thanks in advance.
Benny
Solved! Go to Solution.
Alright, I rechecked on a remote system and looked a bit into what's happening with the collection code. It looks like collection does indeed redraw the contents when you refresh the data.
It looks like the culprit is the PlaysIntroAnimation property that, when disabled, causes data updates to go through a code path that triggers a full redraw. Enabling this property should cause the data update to use the pre 8.4 behaviour which only updated cell contents, in addition to restoring the intro animation (which you may not want).
Ensure that there are no duplicate values for the field you have selected as your UIDField. If you don't want the cells to disappear and then reappear, ensure that the values for that field are stable between updates.
Hi @bmihaiciuc and thanks for your feedback,
yes, I can guarantee the values in UIDField are 100% unique and constant, it's the entity name of the machine. I am wondering if this could be related to my nested approach, I have InfoTables in my InfoTables and also another Collection in my sub-mashup.
Thanks
Benny
The nested tables shouldn't cause the issues in theory. Collection uses only the identifier to determine which item an entry refers to, regardless of where it comes from.
But just to be clear, how does the re-render occur? Do items just disappear and then reappear instantly, or is there an animation associated with this?
It's a dis- and reappearing, the delay of the last item is about 2 seconds.
The following flags are all false if that is your question:
After more investigations I can very certainly say that my issue is in some way connected to the contained Mashup. When I change the Mashup (and nothing else) it works just fine. My current idea is that it is somewhat related to the complexity of the contained Mashup.
What kind of widgets does the cell mashup contain?
I broke it down to just a contained Mashup. Assume I have these Mashups
I am working on this to reproduce this in my dev system but failed so far, probably because I made it too simple. I will upload some demo entities in case I will be able to manage this.
Please find all necessary entites attached, import and open TestForCollectionMashup. The blinking delay in the lower Collection is not super high as it only shows nothing but one image but it's a visible difference to the upper Collection.
I just tried the entities and I can't see the blinking/redraw while using the auto refresh on my end. There is a very slight delay in the initial load due to having to load the contained mashup, but I guess your issue is not with the initial load, but rather subsequent updates.
However looking at the mashups, I saw that one of your cell mashups is just using an inner mashup and nothing else. It is not the case here, but if in your real example you have something bound to that contained mashup's MashupName property you will see that blinking behaviour whenever the name changes because the current contained mashup will be instantly unloaded, but there will be an asynchronous request sent to retrieve the contents of the new one.
If that is the case, you can use the MashupNameField property to control which mashup is used for which cell.
You will also see a similar effect if you are using images and changing the source. The old image gets unloaded and it takes a while for the new one to load - the result will be the contents of the image blinking.
Have you imported the entities to a local or remote system? In case you use a local system perhaps it is to quick to see the effect.
Or perhaps it's matter of the Thingworx version? As stated above I am working on Release 8.4.4.
Also try to not only refresh but also resize the window, e. g. from / to maximize, it also triggers the blinking.
I replaced the image with only a label and still see this behavior which shows it is not related to images. I anyways do not have an image in my original mashup, I only tried to find a simple demo. Makes my example mediaentities obsolete and the example becomes smaller.
I am aware of MashupNameField property, thank you. But it is not involved in my original case. There I kind of rebuild a table format with columns (the collection horizontal with Flow View), a column header (the contained mashup widget within the contained Mashup) and a variable amount of row cells per column (the collection in the contained mashup with Table View). The contained mashup is always not dynamic (except the passed data but not the mashup itself) for the inner and outer collection as well as the contained mashup widget. If you remove the Collection in this scenario you exactly have the case of my demo.
I have the feeling I am failing to be clear enough. Will a short video sequence be helpful? I am hesitating to send my original entities because it has a lot of dependencies, especially to the datasources. And since I am able to reproduce the behavior with the given example I think it should be sufficient.
Alright, I rechecked on a remote system and looked a bit into what's happening with the collection code. It looks like collection does indeed redraw the contents when you refresh the data.
It looks like the culprit is the PlaysIntroAnimation property that, when disabled, causes data updates to go through a code path that triggers a full redraw. Enabling this property should cause the data update to use the pre 8.4 behaviour which only updated cell contents, in addition to restoring the intro animation (which you may not want).
HA! You got it, thank you very much. I confirm the behavior is gone after enabling the intro animation.
I will accept this as the solution even though you are right, I don't want the intro animation. Any alternative suggestion?
Edit: Thank you very much for your support and your durable engagement on this matter.
I am not sure there are any workarounds, but I would encourage you to report this issue to support so it can be hopefully fixed in a future release.
Sure. Where / how can I do that?
Hi @BennyB.
This is a known issue that has been corrected in the latest release of the product, ThingWorx 9.0. There are no plans to provide a patch level update to resolve the issue in 8.4.
Regards.
--Sharon
Understood, thank you.
Hi @BennyB.
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
Very welcome