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

Delete Dynamic Property when Closing the Mashup

Participant

Delete Dynamic Property when Closing the Mashup

Hi,

I'm currently working on ThingWorx 6.5.

My case is, I have multiple source that goes into a service and with a property, I get which one I should return.

Basically, I need to do that in order to have a multi-binding widget.

But I'm getting a "bug" where if there is more than one mashup open, that property is changing for both Mashup, so sometime the property has not the good value.

I was thinking of creating a Dynamic property for each new Mashup. (I would have a service that create the property and return the name, then I can pass that name into the other service to use that specific property).

But then, if I don't delete the property when the mashup closes, then there would be a lot of unused property.

So my question is, is there a way to capture the On Close Event of the mashup or my best bet would be to create a custom widget that capture the on-close event of the web page?

Thanks

9 REPLIES 9

Re: Delete Dynamic Property when Closing the Mashup

I don't think "on close event" it's a good approach, you will end up with lot's of "ghosts" dynamic properties ( browser crashed, tab closed,.. ).

I don't actually know what you want to do, but what about setting a Random value on a hidden textbox to identify different instances of the same mashup, this makes any sense for you?

Re: Delete Dynamic Property when Closing the Mashup

So in my mashup, i have a drop-Down Menu, that pick between 8,12,24 hour. I have two date time widget with a button.

So when the user select an item in the dropdown menu, on selection change event, it calls a service that set a property to "dropDownMenu".

When the user selects Date from the widgets and clicks on the button, it sets the property to "dateTimeWidget".

Then after those  services are called it calls the service that get StartTime depending on the property value. then it calls the end time depending on the property value .

Then it calls a service with the output from those two service and get x data depending of the time.

But if there are multiple mashup open, it might change the value of the property since it's changing the same property.

So what I was thinking is create a dynamic property when the mashup is loading and delete it when it closes. But you are telling me it is not a good practice.

And I don't think, by creating a random value at the start would make it since, it'll be the same property.

Re: Delete Dynamic Property when Closing the Mashup

I still don't get it 100%, but why don't you pass the DropDown Selected value 8,12,24 + DateTimeWidget value to the final service, why you need to work with properties?

Re: Delete Dynamic Property when Closing the Mashup

Frederik Grondin​,

I agree with Carles, I also have the same question. Why are you making changes to the Property.

You can take the input from the DropDown Selected value 8,12,24 + DateTimeWidget. This would actually act as a Dynamic property within the Mashup and pass those as parameters to the third Service.

Re: Delete Dynamic Property when Closing the Mashup

Ankit Gupta

So the final Service returns an Infotable. I would gladly make two of that service that would work separatly.

But, the grid can only have one infotable Source. So I cannot make two services. So, with properties I can tell which "parameter" to use.

I understand that I would only need to pass down DropDown Selected value 8,12,24 + DateTimeWidget. But then in the service how do I chose which parameter I take ?

I'm basing my solution on the correct answer of that discussion.

I would like one button to add rows to a grid widget and another button to remove rows, not sure how...

Re: Delete Dynamic Property when Closing the Mashup

On 7.4 there's a router event widget where you can do this kind of tricky things. Also Tomas Coufal​ had done a port back to previous TW versions.

Another option could be to use a expression widget which builds a json object with the desired optional parameters

Re: Delete Dynamic Property when Closing the Mashup

Here it's the port back from Tomas Events router

Re: Delete Dynamic Property when Closing the Mashup

Hi, when you said "new mashups", are they the same mashup opened by many users, or different mashups ?

If it's the same mashup opened by different users, in the discussion you mentioned, there's a similar solution using session parameter instead of property of a Thing. The conflict will be avoided.

Re: Delete Dynamic Property when Closing the Mashup

Hi Quang-Dung Ngo​ Still if you use session parameters, if the same user opens the same Mashup twice the problem will be there also.

If the final option it's to have a session parameter, then you can set it as Infotable and use a Random value to identify current Mashup instance as said on my first post and record current selected option as a row with pk as Random value given by the mashup.

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________