Skip to main content
Oct 30, 2020 10:17 AM UTC
Question

Mashup: Prevent Change events of controls when Mashup loads

Hello,

 

do someone know how to prevent the Changed event(f.e. Datetime Widget) to be thrown when the Mashup is loaded.

 

I have the following Issue.

 

I want to call a service for data extraction during Mashup loaded and when the Date changed.

When i reload the page the service get called twice (Mashup Loaded + Changed Event of Datetime Widget).

 

Any ideas how i can only call it once without adding a button for "reload"

 

6 replies

Oct 30, 2020 1:46 PM UTC

Hello bot1q,

 

Why do you need the Changed Event ( Datetime Widget ) to be binded to the service ? You could use an Auto Refresh widget to have a refresh at a specific time interval. In this way when the data gets changed it will update in the mashup.

bot1qAuthor
Oct 30, 2020 1:51 PM UTC

Why do you need a car, you can drive a bicycle ...

 

Sorry but please dont question why we need something *no offence* but your answer dont help

 

 

Easy case:

 

You have a Table where the data is loaded via a Service.

You have a Datetimewidget (FROM) -> Request to same service with different FROM Date (OnChangedEvent)

You have a Datetimewidget (TO) -> Request to the same service with different TO Date (onChanged Event)

 

 

now you open the Mashup and the service is called by "Mashupload" Event, by OnChanged Events from 2 Datetimewidgets.

 

In Sum the service get called 3 times dureing Mashup load.

 

I just want to understand how i can prevent the calls from the Datetimewidgets directly after Mashup Load.

 

 

 

Nov 2, 2020 3:45 PM UTC

Hello @bot1q 

 

From date picker, date changed event will fire only when date selection has changed, it generally won't fire on mashup reload, because I have used  the same in my app and it's not triggering multiple times. I'm using thingworx 9.0.

 

If you are not able to handle this or if it's issue in your thingworx version then you can do some workaround such as add validator by taking the selected date as input, if selected date is not blank or changed  then only call your service. Invoke the validator on date change and mashup load event.

 

bot1qAuthor
Nov 3, 2020 10:13 AM UTC

Thanks,

 

but for checking if the date has a change I need to save the last status or? Because on Mashupload i dont have any previous states.

 

Do you have a hint?

Nov 4, 2020 1:28 PM UTC

Use session parameter, update and read it from there.