2 Replies Latest reply on Mar 18, 2016 1:26 PM by leisel RSS
    leisel Explorer

    Binding Thing properties into a Data Table

    My goal right now is to have the properties of a few Things that, when changed, are updated in a DataTable which is in a separate Mashup. The guide I somewhat worked off of gave me info on populating a DataTable but only by writing info into a number/text box and clicking a Button to add and update the table. If there's a tutorial more closely related to what I need done that would be appreciated.

     

    Background: My overall project is a home security application. We've already created a Mashup that changes the On/Off value property of a few Things(representing sensors for us). We have a simple Slider that can change from value 0 or 1 and will change the color of a Shape that sits above the slider to physically represent the sensors On/Off state for a user. This all works and bindings make sense so I am positive that our On/Off property for our Things is correctly being changed.

     

    I'm saying this because I've been having trouble binding this information onto a Data Table, and am not sure whether I'm doing something wrong, doing something not possible or doing something that should be done a different way. I followed this tutorial:

    https://plms4schools.ptc.com/precisionlms/app/wicket/page?8  "How to Video: Create a DataTable Administration Mashup" ,

    which instructs me how to create services for a Data Table that, in the Mashup, will read-in numbers and strings to be fed into the Data Table after clicking a Button to update the table.

     

    Because I had multiple Things that I wanted to fill into the Data Table, rather than creating an 'EnterMyInfo' service like in the example, I created variations of sensor info services(MotionSensorInfo, DoorSensorInfo...) which all mirrored each other with the basic information that our sensor Things would have. I tested the services like he does in the video. For attempting all of this I only binded the On/Off value property of my sensors to the On/Off value in the services' parameters, just to save time to see if this was possible.

    I tried a Button as well as an Auto Refresh Widget to bind to the services, then with each service dragged the ServiceInvokeComplete into the GetTableEntries service(just mirroring what they did in the video except for the fact i'm using Things rather than textboxes).

     

    When I attempted to change the values in my Mashup with the sliders, then move over to the Mashup with the DataTable there was never any changes. If there are any things I am doing improperly or something not possible, or if there is a better tutorial that could relate more to what I need done please let me know.

    Thank you for reading.

      • Re: Binding Thing properties into a Data Table
        pchung Collaborator

        All information is entered into DataTables using services, that part you got down already.

        Next you need an event to trigger the service and bind your inputs into the input parameters of your service.

        If you are using sliders, make sure you bind the Value Changed event that I believe the Slider has to trigger your service. (Avoid tracking mode)

        Looks like you are well on your way.

          • Re: Binding Thing properties into a Data Table
            leisel Explorer

            Yup it ended up working. It turns out that this isn't actually what we wanted. I'm guessing we want a Stream or Value Stream instead, because we wanted a history log of any changed property of our Things, and the way I had it created made each record overwrite itself after a Thing's property had changed. Like if i had 4 Things showing their properties on the Table, and then changed one's property value, the Table would just show the 4 Things with one of them updated, rather than a new record showing a different value.

             

            Is that how Data Tables are supposed to work, or was I maybe implementing mine in the wrong way?