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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

In a repeated mashup, how to call a service on the main mashup ?

sebastienl
1-Newbie

In a repeated mashup, how to call a service on the main mashup ?

Hi Thingworx Gurus,

I'm creating a mashup "Main" containing a Repeater widget repeating a mashup "Repeated". I have properly bind data on the repeated widget, created a parameter on the mashup "Repeated" , everything is working fine.

Now I want to call a service defined on mashup "Main" from the mashup "Repeated" (after a service invoke in "Repeated") to refresh the repeater widget list. Is there a magical way to do it ?

Thanks a lot,

       Sébastien

9 REPLIES 9

Sebastien, you can use 'Session Parameters' for this. Under the User Management Subsystem, add a ThingShape with, say a Boolean property called 'Temp'. Now, in your Mashup Builder screen, under the 'Session' tab, you should see this property (if you don't, close and re-open your Mashup). You can now probably bind something from Repeated to this value so that it changes when your service is invoked in Repeated. Go back to your Main Mashup, click on the Sessions tab and Temp, and you can either use the actual property or use the property's Changed event based on what you want. Does this make sense?

Hi,

First, my apologies for my very late answer (I moved temporary to another subject...).

Your solution was something I was thinking about but I didn't know if it's an acceptable and robust solution. I will perform some test with this solution.

Thanks a lot,

       Seb

aduarte
6-Contributor
(To:Aanjan)

Hello Aanjan Ravi,

I have the same problem that Sebastian refers to.

I tried to use variable sessions and it doesn't work all the time, it's seems quite aleatory when it works and when it doesn't.

There's really no other possibility to call a service defined on mashup "Main" from the mashup "Repeated" (after a service invoke in "Repeated") to refresh the repeater widget list and the main mashup?

Thanks a lot,

Ana.

Aanjan
9-Granite
(To:aduarte)

Ana, the Repeater widget does not have anything to bind from. The only event it has is a 'DoubleClicked' event that you can use to trigger a service on the Main Mashup. Using Mashup parameters wouldn't work in this case as well, because it would show up in the data section of the Repeater widget (unlike Contained Mashup where you can can use them to bind to the Main Mashup). Using Session Variables would be easier way to go. When you say that doesn't work all the time, do you get blank/ null values or are they incorrect values?

aduarte
6-Contributor
(To:Aanjan)

Hello Aanjan Ravi,

Thank you for your answer.

I also saw that the only possibility that i have for now is to use session variables.

The event 'DoubleClicked' is not suited for what i need, and i had also verified that the mashup parameters can't be used for this purpose, as you say.

For the solution with Session Variables, i get blank/null/undefined values when it doesn't work.

Maybe there's something more that i should do?

Thanks a lot,

Ana.

Aanjan
9-Granite
(To:aduarte)

How are the variables stored? Do they get values from the one of the 'repeated' Mashups and then use that in the Main Mashup? Does it fail consistently on a specific Mashup or is it random?

aduarte
6-Contributor
(To:Aanjan)

Yes, they get values from the one of the 'repeated' Mashups and then use that in the Main Mashup.

The fail it's random, even if it fails more than it works.

Ana,

What I ended up doing for this was creating a navigation/browsing Thing per user.  Each time a new user is created (using a mashup) I create a navigation thing.  To keep my mashups up to date and populated with the correct data I use set/get services as well as an auto refresh widget.

I use the set property service inside my repeated mashup then the auto refresh triggers the get service which makes sure that I get the new value passed up to where it needs to go.

I know this is probably overkill for what you might need, but it works really well in my application.

I hope this helps.

Thanks,

Paul

aduarte
6-Contributor
(To:pbaierl)

Hello Paul,

Thank you for your answer.

Indeed, your solution is a very good one, with an auto refresh we can be sure that we call the services that we need to be called.

However, for my case, i need to update the information of the main mashup after clicking on a button of the repeater mashup. With an auto refresh this update is not going to be synchronized with the click action.

I'm going to try to update the session variables in a different way, try to be sure that they are always informed and that they trigger the datachanged event every time i need.

Thanks a lot,

Ana.

Top Tags