4 Replies Latest reply on Sep 23, 2016 11:49 AM by mchang RSS
    mchang Newbie

    Passing values between Mashups and Contained Mashups

    Hi. I'm taking on my first attempt to building a "object based" display/mashup that's basically a mashup with 5+ contained mashups, widgets, a menu, and security. I'm hoping to start off with some best practices that everyone can share. My goal is to be able to make modifications to the contained mashups so that I wouldn't have to make changes "everywhere". Here's what I'm trying to achieve and have gathered from reading on discussions here and some trial and error.

     

    1. Passing values into a contained mashup - It seems like there are 3 ways to passing values into a contained mashup.

      1. Pass an entity into the Entity property of the contained mashup widget. I've managed to do this by grabbing the name field out of the GetImplementingThings service and passing it to the contained mashup's Entity property.
      2. Add custom session variables and set them by the main mashup and have the contained mashup pull it. (?)
      3. Add mashup parameters that are named the same to pass values. (?)

     

    I believe 1.a works great if you have Things all setup in ThingWorx, and thus entities. But if, instead of a list box that lists Things based on ThingTemplates, I have a list box based on records from a database and I want to pass the primary key (Id) around? I imagine I'll have to use 1.b or 1.c, correct?

     

    2. Passing values from a contained mashup to the parent mashup - Looks like the same 3 ways as above? The entity property of the contained mashup widget has two way arrows, so it seems like I can send an entity back up. But if I'm passing a value into the contained mashup to load a database table and I want to pass the ID selected in the grid back up to the parent, I imagine I'd need to use session variables or mashup parameters too.

     

    On a side note, I've seen/used name out of GetImplementingThings and it seems to be the same as Entity and EntityName. Is this an actual object that's being passed around or just text? If it's just text, would I be able to bind a database field's text (that's named the same as a Thing) over the Entity or EntityName properties/parameters?

     

    Thanks a ton ahead of time.

    Michael