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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to check result of property from GetImplementingThingsWithData

skoessler
10-Marble

How to check result of property from GetImplementingThingsWithData

Hi everyone,

I have multiple things which are based on a ThingTemplate. I use GetImplementingThingsWithData to get all the values of one property (state) of all implementing things. Now I want to check if the values of the property have changed. If they have changed I want to trigger an event which can be used to invoke a service that updates a widget.

I tried to achieve this with:

a) Validator and its true-event

This is not working because I cannot handle the list of booleans in the expression.

b) Write a custom service which checks the input and emits an event.

I don't know how to use the custom event to update a widget by invoking another service in the mashupbuilder.

It would be really nice if someone can give me a hint.

Cheers

Sebastian

ACCEPTED SOLUTION

Accepted Solutions

In the end my solution looked something like this:

I implemented a custom service which used GetImplementingThingsWithData to retrieve all states of my observed things. The Booleans are persisted in an infotable. The infotable is used to compare the current states with the old states. The service returns a boolen to signal if a state has changed.

In the mashup I triggered the custom service with the autorefresh widget.  Also an validator and its true event was used to invoke the service which is used to update the information on the map.

I'm not happy with this approach but it works for now.

View solution in original post

6 REPLIES 6
ttielebein
14-Alexandrite
(To:skoessler)

I believe all you need is the auto-refresh widget. Just set this to refresh every 5-10 seconds and bind the refresh event to the service which populates the data on your mashup. You may need to set the Data Change Type to Always on the properties as well. The auto-refresh widgets do not need to be visible on the mashup to work.

Hope this helps!

Hi Tori,

I forgot to mention that I want avoid the auto refresh widget because than the map keeps blinking and produces a lot of cpu load. Also fast reaction times are needed that's why 5-10 seconds are not acceptable.

Thanks

Sebastian

ttielebein
14-Alexandrite
(To:skoessler)

I don't see how you'll avoid the "flashing". If you need to update the data bound to a map widget, you have to call the service to retrieve the data, which will update the map widget

Hi Tori,

Imagine I want to display some status update event on the map. This event happens very rare, but when it happens it should be visible immediately. I would prefere to use the event system to invoke the service instead of constantly updating the map at high frequency.

Also sometimes the map misbehaves when using the auto refresh widget with 1 seconds interval. For instance the marker dissapear for random intervals.

Cheers

Sebastian

In the end my solution looked something like this:

I implemented a custom service which used GetImplementingThingsWithData to retrieve all states of my observed things. The Booleans are persisted in an infotable. The infotable is used to compare the current states with the old states. The service returns a boolen to signal if a state has changed.

In the mashup I triggered the custom service with the autorefresh widget.  Also an validator and its true event was used to invoke the service which is used to update the information on the map.

I'm not happy with this approach but it works for now.

ttielebein
14-Alexandrite
(To:skoessler)

There is an enhancement request open for this Jira. Documentation is in KCS Article CS251652. In the meantime, this workaround seems good to me.

Announcements


Top Tags