Skip to main content
1-Visitor
Aug 23, 2018 11:00 AM UTC
Question

queries

Hello community,

I am just starting with thingworx and i wanted to know how to write queries (using SQL) and not Javascript to fetch some entries from a datatable created previously on thingworx

5 replies

raluca_edu
17-Peridot
Aug 24, 2018 6:57 AM UTC

Hi,

 

To do this , you should create a new service, when window opens, you have near New Service a dropdown list with: Local (Javascript), SQL( Query), SQL (Command). You should choose SQL (Query) or SQL(Command). Then , you can start writing your SQL query.

For differences between the 2 options are explained here: Difference between SQL (Query) and SQL (Command) service types in ThingWorx

 

Best regards,

Raluca Edu

Translate
1-Visitor
Aug 24, 2018 12:15 PM UTC

Well actually to query data from ThingWorx Storage (ValueStreams, Streams and DataTables) you can't use SQL, you have to rely on ThingWorx querying Snippets. The other way around it's not recommended and it isn't as easy as pointed out by raluca_edu (an data storage for ThingWorx object may change between TW Storage versions and it will fail).

Translate
i_abidi1-VisitorAuthor
1-Visitor
Aug 24, 2018 2:24 PM UTC

CarlesCol, so if i wanted to perform a query on a datatable in Thingworx and let's say i wanted to select the entries HAVING certain conditions, i can not do it unless it's on an SQL server ? or i can still create a javascript (not so good with javascript) service to do the query?

Translate