Skip to main content
14-Alexandrite
July 10, 2023
Solved

How to read the mysql data to the generic thing properties in the Thingworx (9.3.0) ?

  • July 10, 2023
  • 1 reply
  • 2871 views

Hello,

I have the Thing which is connected to the mysql database and I am able to retrieve the data to the thingworx mashup by writing the services in the database thing.

ab.png

 

So now i need to get the parameters value of the mysql database table in the generic thing where the properties .are there

cd.png

NH_shree_0-1688988807601.png

 

 

instead of getting the data from the database thing by fetching the data through the services , can we get the parameters values into thing properties which should be updating every time when the new data is logged in the database.

 

If anyone have tried this, please help me to sort out this issue.

 

Regards,

Shree

 

Best answer by Velkumar

Hi @NH_shree 

 

As I said earlier use Timer / Scheduler Event (based on your requirement) to execute the update script.

 

For example: If you want to update property value every 5 mins

1. Create a TimerThing with Timer Template 

2. Set the update rate to 300000 milliseconds (5 mins)

3. Create a subscription in Timer Thing with Timer Event

4. Call propertyUpdateScript in Subscription

 

So property value will be updated every 5 mins

 

Note: Fetching data from DB with a low update rate (say every second or 2) will cause performance issues. 

 

/VR

 

1 reply

19-Tanzanite
July 10, 2023

Hi @NH_shree 

 

I don't think we can get new logged data events/triggers from DB.

 

Maybe based on your requirement you can create a scheduler and update data from the Database to Thing Property

 

/VR

 

 

NH_shree14-AlexandriteAuthor
14-Alexandrite
July 11, 2023

Hi @Velkumar ,

 

Right now i am able to get the data updating on the mashup but it is not the historical data which will store in the query property history because i have the thing which is directly fetching the data from the database through the sql queries written in the services .

 

I need to get the historical data which will be also stored in the thing properties so that the thing can be used in the vuforia  AR /VR experience , so how can i get the mysql data to the generic thing template properties ? 

 

Regards,

Shree

19-Tanzanite
July 11, 2023

Hi @NH_shree 

 

What do you mean by you want to store historical data in Thing property?

 

Do you want to store all rows from DB to store in the Thing property or only the latest value should be stored in the Thing property?

 

/VR