Skip to main content
1-Visitor
April 19, 2017
Question

Delete Dynamic Property when Closing the Mashup

  • April 19, 2017
  • 2 replies
  • 3068 views

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

    2 replies

    1-Visitor
    April 19, 2017

    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?

    fgrondin1-VisitorAuthor
    1-Visitor
    April 19, 2017

    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.

    1-Visitor
    April 19, 2017

    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?

    1-Visitor
    April 19, 2017

    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.

    1-Visitor
    April 19, 2017

    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.