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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Medical Data Storage and Display Part 2

No ratings



Step 4: Create Thing


Now that we have a Data Shape to format the combination of data coming from the various sub-systems, we can now instantiate a Thing with an Info Table Property to hold all of said data.


  1. Click Browse > Modeling > Things.



  2. Click + New.
  3. In the Name field, type MDSD_Thing.
  4. If Project is not already set, search for and select PTCDefaultProject.
  5. In the Base Thing Template field, search for and select Generic Thing.



  6. At the top, click Save.


Add Info Table Property


We now have a Thing to aggregate the MRI sub-system information, but we still need a Property to perform the actual storage.


We'll use an Info Table Property for this, with the columns of the Info Table formatted by the Data Shape we created in the previous step.


  1. At the top, click Properties and Alerts.



  2. Click + Add.



  3. On the right in the Name field, type MDSD_InfoTable_Property.
  4. Change the Base Type to INFOTABLE.
  5. In the Data Shape field, search for and select MDSD_DataShape.



  6. Check the box for Persistent.



  7. At the top-right, click the "Check" button for Done.
  8. At the top, click Save.




Step 5: Create Service


Now that we have a Thing with an Info Table Property to store our aggregated data from multiple MRI sub-systems, we need to develop a Service which will grab said data and propagate that information into the Info Table Property.


  1. At the top of MDSD_Thing, click Services.



  2. Click + Add.



  3. Under Service Info in the Name field, type MDSD_Aggregation_Service.




Access to MRI Sub-systems


We now need to access the various sub-systems of the MRI that are already talking to ThingWorx Foundation.


Once again, we'll only be doing so for two sub-systems in this MVP example. But the general premise will extend to as many remote devices as is necessary.


You will simply add more references as additional sub-systems are needed.


  1. In the Javascript code window, copy-and-paste in var embedded_properties = Things["MDSD_Embedded_Thing"].GetPropertyValues();
    • This provides a reference to the embedded microcontroller's Properties.
    • All Things are accessible in Foundation via the "Things" array, and you simply need to provide the Thing-name to index into the array; this functions similarly to a "global" variable, so that any Thing can reference any other Thing.
    • The built-in GetPropertyValues Service simply returns the values of all Properties of the Thing being referenced.
  2. In the Javascript code window, copy-and-paste in var pc_properties = Things["MDSD_PC_Thing"].GetPropertyValues();
    • This provides a reference to the PC's Properties.




Add Values to Info Table


Now that we have references to the sub-systems, we'll add their individual Property values to each field of the Info Table Property.


We'll do this via the built-in AddRow() Service.


  1. To begin an AddRow Service call, copy-and-paste me.MDSD_InfoTable_Property.AddRow({

    • The me reference is MDSD_Thing, since we're inside said Entity.
    • The MDSD_InfoTable_Property is the Property we added in this guide's previous step.
    • The built-in AddRow Service will add each following Property value to a field of the Info Table formatted by the previously-created Data Shape.



  2. Copy-and-paste Coolant_Percent:embedded_properties.Coolant_Percent,

    • This stores the embedded microcontroller's "Coolant Percent" in the first field of a row of the aggregated Info Table.



  3. Copy-and-paste Field_Strength:embedded_properties.Field_Strength,

    • Likewise, this references the second Property of the embedded microcontroller to store in the second field of the Info Table.



  4. Copy-and-paste Magnet_Temperature:embedded_properties.Magnet_Temperature,



  5. Now that we have all the embedded microcontroller's values, copy-and-paste the following lines for the PC's values:



  6. We also want to record the Timestamp (via the built-in Date Service) when these entries were added; copy-and-paste



  7. Finally, close off the AddRow Service with some braces, i.e. copy-and-paste });



  8. Review the entire Service in Foundation and ensure that it matches the Javascript code below.

    var embedded_properties = Things["MDSD_Embedded_Thing"].GetPropertyValues();
    var pc_properties = Things["MDSD_PC_Thing"].GetPropertyValues();me.MDSD_InfoTable_Property.AddRow({
        Number_of_Scans:pc_properties.Number_of_Scans,    SSD_Space_Open:pc_properties.SSD_Space_Open,
  9. For the MDSD_Aggregation_Service, click Done.
  10. Click Save.



Test Service


Before going further, we should test the Service to ensure that it is correctly adding entries to the aggregate Info Table Property.


  1. On the MDSD_Aggregation_Service row, under the Execute column, click the Play icon.



  2. At the bottom-right of the Execute Service pop-up, click Execute.



  3. Click Done, and return to Properties and Alerts.

    • Notice under the Value column that the Info Table Property now has an entry.



  4. Under the Value column, click the Pencil icon for Edit.



  5. Review the values and confirm that every field has a valid entry.
    • Note that your values will differ from those in the picture due to the random nature of the simulator.
  6. On the pop-up, click Cancel.
  7. At the top, click Save.



Step 6: Create Mashup


Now that we have a Thing that has logically aggregated the infomation into a single Info Table Property (and a Service to carry out said aggregation), we can start to visualize the data with a Mashup.


For more information on Mashups, reference the Create Your Application UI guide.


  1. Click Browse > Visualization > Mashups.



  2. Click + New.



  3. On the New Mashup Pop-up, leave the defaults, and click OK.
  4. In the Name field, type MDSD_Mashup.



  5. If Project is not already set, search for and select PTCDefaultProject.
  6. At the top, click Save.



  7. At the top, click Design.



  8. At the top-left, click the Layout tab.



  9. For Positioning, select the Static radio-button.



  10. At the top-left, click the Widgets tab.
  11. At the top, click Save.





We now have a "Static Positioning" Mashup, which will let us drag-and-drop Widgets without them auto-expanding to fill the entire space. This will alow us to have multiple Widgets without worrying about sub-dividing the Mashup.


In particular, we're interested in the Grid Widget to display our aggregated data, as well as a Button Widget to call the Service to perform the aggregation.


  1. On the left in the Filter Widgets field, type grid.



  2. Drag-and-drop a Grid Advanced Widget onto the central Canvas area.



  3. In the Filter Widgets field, type button.



  4. Drag-and-drop a Button Widget onto the central Canvas area.



  5. Re-size (by clicking-and-stretching) and move the two Widgets such that they look roughly like the picture below.



  6. Click the Button Widget to select it.
  7. In the Filter Properties field of the bottom-left Properties section, type label.



  8. In the Label field, type Retrieve MRI Statistics, and then hit the Tab keyboard key to lock in the change.



  9. At the top, click Save.




Click here to view Part 3 of this guide.

Version history
Last update:
‎Mar 07, 2023 02:48 PM
Updated by:
Labels (1)