Skip to main content
1-Visitor
August 6, 2014
Question

Simple Mashup binding thing to gauge widget

  • August 6, 2014
  • 10 replies
  • 3672 views

Greetings,

I'm going through the TWX tutorial work book. I've created 3 Vending Machins VM-TR1, VM-TR2, and VM-TR3. I want to create a mashup which contains a gauge which represents the current temperature of VM-TR1.


I've created the mashup and placed the gauge widget in the layout, but i'm not sure how to bind it to VM-TR1 CurrentTemperature property.


Seems pretty trivial, but I'm just not getting anywhere.


Can anyone point me to some documentation or guide me through this mashup exercise?


I'm using Thingworx 5.0 SP1

    10 replies

    5-Regular Member
    August 6, 2014

    Hi Robert, You have to add twoentities for that. The first one would be the(which holdsthe Vending Machine names) and the entity name to be chosen is. Thesecond one is the(whichholds the Vending Machine properties) and the entity to be chosen is the.



    Inthe Mashup,from Vending Machine Template shouldbe bound to aand thefrom Dynamic Vending Machine Templateshould be bound to the.Then theproperty from the Vending MachineTemplate must be bound to theproperty in DynamicVending Machine Template (This enables to switch the gauge readings between thevending machines). TheMashup event can be bound to theDynamic Vending Machine so that the values change automatically when switchingbetween the machines.But remember that unless you input in data, the gauge will be empty



    rtaylor-31-VisitorAuthor
    1-Visitor
    August 6, 2014

    Ok...that helps me understand things better...however, i'm not having luck with binding the All Data to the List Widget. I dragged All Data over to the Data property of the List Widget. The binding connection shows up in the connections window, but when i run the mashup, nothing displays. I know i have 3 implemented vending machines. I can prove this by invoking http://localhost:8080/Thingworx/ThingTemplates/VendingMachineTemplate/Services/GetImplementingThings?method=post which returns 3 records. I'm still not doing something right.

    rtaylor-31-VisitorAuthor
    1-Visitor
    August 7, 2014

    Ok...i am now able to display a simple list. The problem was that i hadn't configured the mashup loaded event to call the GetImplementedThings method. After configuring the mashup for this event, the vending machines load into the list.

    As trivial as this sounds, there really should be a simple video tutorial on this.


    Now onto configuring the gauge....



    rtaylor-31-VisitorAuthor
    1-Visitor
    August 7, 2014

    Ok....i have searched up and down and cannot find anything on DynamicXXXTemplate. There is nothing in the tutorial work book about it. I'm not sure what to create. Is there any documentation on Dynamic XXXX Templates?

    5-Regular Member
    August 7, 2014

    Did you make sure to check the

    Dynamic box

    and then choose your Vending Machine Template ? When you do that, you can scroll down to the properties section (on the left) and then choose

    GetProperties

    . Or even type

    GetProperties

    in the

    Select Services Filter Box.



    Once again, without feeding it data, you won't be able to see anything on the Gauge.

    rtaylor-31-VisitorAuthor
    1-Visitor
    August 7, 2014

    Ok....making some progress now. I added the VendingMachingTemplate as a Dynamic data source and was able to bind the VendingMachineTemplate property 'name' to the DynamicVendingMachingTemplate property 'entity'. 

    I have bound my DynamicVendingMachingTemplate property 'CurrentTemperature' to the gauge 'data'. 


    However, i cannot find a SelectedRowChanged event on the mashup or list widget. 


    Therefore the gauge is not responding.



    5-Regular Member
    August 7, 2014

    The SelectedRowChanged event will be on the Dynamic Vending Machine Template entity. When you select the GetProperties header, you will be able to see the event on your bottom right.

    rtaylor-31-VisitorAuthor
    1-Visitor
    August 7, 2014

    The only event i see when i select DynamicVendingMachineTemplate GetProperties header is ServiceInvokeCompleted

    5-Regular Member
    August 7, 2014

    Are you following a specific workbook ?



    rtaylor-31-VisitorAuthor
    1-Visitor
    August 7, 2014

    I'm going through the Thingworx 5.0 Workbook. It really falls down when it comes to describing how to create mashups and bind widgets to data. I was trying to come up with a very simple example for this. I thought that displaying a list of Vending Machines and selecting a vending machine from the list to display its current temperature would be a fairly simply exercise. So this is what i'm trying to accomplish.

    I think i'm almost there...i just can't get the gauge to respond when i select a vending machine from the list. Each vending machine thing has a slightly different current temperature so it is evident that the binding is working.

    5-Regular Member
    August 7, 2014

    Hi Robert,

    Typically, the workbook is used during in-person training sessions where an instructor will demonstrate how to create

    Mashups

     and bind data to widgets. For a more visual learning experience, I recommend following the introductory ThingWorx course available from PTC eLearning.


    To answer your specific question, you won't use the SelectedRowsChanged

    Event

    , as non exists for

    GetProperties()

    . Instead, you'll use this same

    Event

    , but for the

    GetImplementingThings()

    Service

    , which is populating the List. Then, as the selected rows change (i.e. you select entities), the

    Event

     will fire and execute

    GetProperties()

    .


    Regards,

    Adam



    rtaylor-31-VisitorAuthor
    1-Visitor
    August 7, 2014

    Hi Adam....watching 

    Communicating with Things using ThingWorx 5.0 (Part 2 of Introduction to ThingWorx 5.0) from PTCU eLearning. 

    This is perfect and exactly what I needed.

    Funny it uses a very similar exercise as the one i was trying to put together.


    Thanks!