Skip to main content
14-Alexandrite
January 9, 2023
Solved

How to display the SQL query into LED and Gauge Widget

  • January 9, 2023
  • 2 replies
  • 4860 views

I am trying to get one SQL query into the LED widget and another SQL query into the Gauge Widget. I am unable to do the bindings from the MSSQL connection thing to the Mashup.

Best answer by jensc

Hello,

 

What you have in your screenshot is just that the loaded event of your mashup is triggering the "GetProperties" service of your DB connection thing.

 

You want something similar to this:

jensc_0-1674636680421.png

Although as previously described, if you only want to use one row, and show it in a LED or Gauge widget, then you can not use an infotable binding and should instead use the row value of the infotable as shown before:

jensc_1-1674636882982.png

 

I'm not sure if this "GetProperties" is the out of the box service that many things have. If that is the case, it might not work for what you are trying to do.

Instead you want to make your own service. 

Here are some resources you can use to get you on your way to create your own services:

PTC Help center - Creating, Implementing, and Testing Services

PTC IoT Tips - Implement Services, Events, and Subscriptions

PTC IoT Tips - Working with External Databases 

 

Hope this helps.

 

Regards,

Jens

2 replies

17-Peridot
January 9, 2023

Hello,

 

Perhaps this guide could help you.

 

In this guide they describe quite well how to bind data from a service to a widget.

 

Regards,

Jens

15-Moonstone
January 9, 2023

Did you set a datashape in your service? If not, you can't bind the data because the mashup builder doesn't know how the data is structured.

 

In addition: It is usually better to use another thing with custom services acting as a "UI-controller" between connector things and the mashup builder. In that way you are able to add error handling or do transformations of the returned results.

14-Alexandrite
January 9, 2023

Thank you for the inputs .

Please note i have followed the below steps:

1)Created a MSSQL database thing and got all the tables into TWX.

2)Created a query service for a specific row and a column(Single value) Ex: GetPressure( Latest Pressure Value).

3)Execute the Query and created a DataShape of the result as PressureDataShape

4)For the GetPressure service the output table is set as InfoTable and the datashape is mapped to PressureDataShape

5)On the Mashup tried to get the MSSQL Service GetPressure and tried to bind it to a LED Display but it doesnt happen.

 

What i am doing wrong ?

15-Moonstone
January 9, 2023

Can't you drag and drop the binding to the "Data" element of the widget? Have you tried it alternatively via the "Configure Bindings" popup? For this you have to click on the triangle when you have selected the widget and then on "Configure Bindings".

 

Or does the binding exist but the values are not displayed? Then you should make sure that the service is triggered.