Skip to main content
12-Amethyst
April 2, 2020
Solved

Technical question about query;

  • April 2, 2020
  • 2 replies
  • 983 views

Hi All,

 

I have a thingTemplate A; A has a property name of type string;
I have a thingTemplate B which has a property a of type A.
 
How Can i do a query to retrieve all B with A.name = "myName" ?
 
 
Thanks for your help.
Best answer by Constantine

Hello @cbaurand,

 

Unfortunately there are no JOINs in ThingWorx data model, so you can't do something like what you would do in SQL: "SELECT * FROM A LEFT JOIN B ..." The things are "linked" together via their names, which are simple strings. ThingWorx doesn't ensure referential integrity and/or simplify queries for you in this case.

 

So if you need to find an object A based on B's property, you need first to run a query to find B's thing name, and then do another query to find A, which uses this name.

 

Regards,
Constantine

2 replies

18-Opal
April 2, 2020

Hello @cbaurand,

 

Unfortunately there are no JOINs in ThingWorx data model, so you can't do something like what you would do in SQL: "SELECT * FROM A LEFT JOIN B ..." The things are "linked" together via their names, which are simple strings. ThingWorx doesn't ensure referential integrity and/or simplify queries for you in this case.

 

So if you need to find an object A based on B's property, you need first to run a query to find B's thing name, and then do another query to find A, which uses this name.

 

Regards,
Constantine

Support
April 9, 2020

Hi @cbaurand.

 

If the previous response answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon