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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Technical question about query;

cbaurand
11-Garnet

Technical question about query;

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.
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

2 REPLIES 2

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

slangley
23-Emerald II
(To:cbaurand)

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

Top Tags