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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Dynamic SQL Data in a Label Chart with SQL query from service

anshunagdev
5-Regular Member

Dynamic SQL Data in a Label Chart with SQL query from service

Hello,

I am looking for a solution where I need to display the Data from a SQL Table(with only 3 columns) on a Label Chart, only top 5 rows(with dynamic data) needs to displayed and this table keeps on updating at every 10 minutes. I am able to display that on a  Grid Widget but can't find a solution for Label Chart Widget. Have already referred the guide from Developer Portal with this link but couldn't find the solution,as it mentions only static data from InfoTables. https://developer.thingworx.com/en/resources/guides/display-data-charts . Any inputs would be highly appreciated.

SQL Query.png 

anshunagdev_0-1599300375913.png

Mashup with Grid Widget & Label Chart Widget

anshunagdev_1-1599300499577.png

 

Regards,

aNagdev

 

 

7 REPLIES 7

What if you store the SQL result in a Datatable entity and then extract it to a Label chart?

 

Don't you need to record the SQL result in TWX side? 

anshunagdev
5-Regular Member
(To:zyuan1)

Hi @zyuan1 . Thanks for the input. This data will not be stored at ThingWorx side. This application has no provision to store data at the ThingWorx end. All the data in this application is real-time data from control system except this only SQL table data which is being updated continuously at every 10 Minutes in SQL. 

That is the reason why the content is dynamic in SQL table i.e. top five rows can have different alarms & different counts value.

 

      

If it will not store in a Datatable, can you try store the data in an infotable property, and then retrieve the data from this property?  Just want to check if there's a intermidiate storage, the chart would work.

anshunagdev
5-Regular Member
(To:zyuan1)

Hi @zyuan1. Thanks again for the inputs, I tried storing that data into an Infotable property and then when i try to bind this property with the label chart properties, somehow i am not able to do that, the XAxisField and DataFields gets disabled, please refer the snapshots below. It doesn't allow me to bind the parameters.

anshunagdev_0-1599727903127.png

anshunagdev_1-1599727966538.png

Any idea, what could be the reason ?

 

 

That would mean the current data you have, does not meet the Xlabel property request.  If you have Integer column, TimeStamp column, that might be chosen as potential X Label property.

anshunagdev
5-Regular Member
(To:zyuan1)

Yes. you are right, the data i need to bind with XAxisField is  actually a String Type Data i.e. "AlarmName" and my requirement is to plot those alarms name on X-Axis and the "TotalCounts" on Y-Axis.

These Alarms are dynamic i.e. keep on changing in SQL table.

I have seen that working with label chart in one of the ThingWorx Demo's, but not sure how to do it. 

Then you can check for Bar Chart in Chart Type, or you may want to try others.

Top Tags