<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Relational join query in ThingWorx in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955133#M66893</link>
    <description>&lt;P&gt;Hi Ashish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not an expert on this, but I can share an example that my team has built.&lt;/P&gt;&lt;P&gt;There are 2 tables in our example : Attributes, and AttributeValues. They each have their own DataShape. The AttributeValue table includes column AttributeUid, which joins on Attributes' Uid. So here is what they did for a Select :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let MyFilter = {
select: [{dataShapeName: 'CompanyNameHere.AttributeValue', fieldName: 'Value'},
{dataShapeName: 'CompanyNameHere.AttributeValue',fieldName: 'AttributeUid'}],
filters: {
filters: [{dataShapeName: 'CompanyNameHere.AttributeValue',fieldName: 'IsProcessed',type: 'EQ',value: 0}]
},
joins: [{type: 'INNER', sourceDataShapeName: 'CompanyNameHere.AttributeValue', sourceFieldName: 'AttributeUid', targetDataShapeName: 'CompanyNameHere.Attribute', targetFieldName: 'Uid'}]
};

result = me.GetManyOf({Filter: MyFilter, DataShapeName: 'CompanyNameHere.AttributeValue'});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe this is the equivalent of this query :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT av.Value, av.AttributeUid
FROM AttributeValues av 
JOIN Attributes a ON a.Uid = av.AttributeUid
WHERE av.IsProcessed = 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let us know if that helps.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 15:01:46 GMT</pubDate>
    <dc:creator>mstarnaud</dc:creator>
    <dc:date>2024-06-07T15:01:46Z</dc:date>
    <item>
      <title>Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955040#M66884</link>
      <description>&lt;P&gt;Is there something equivalent to a simple SQL Join query as below in ThingWorx:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT T1.Name, T2.Name, T2.Date FROM&lt;/P&gt;&lt;P&gt;Table1 T1 INNER JOIN Table2 ON T1.Name = T2.Nname&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 10:29:16 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955040#M66884</guid>
      <dc:creator>ashishtamhane</dc:creator>
      <dc:date>2024-06-07T10:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955068#M66885</link>
      <description>&lt;P&gt;Are you asking about this capability for an infotable? Or are you asking how to execute SQL commands to an external SQL table from within ThingWorx?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 11:18:09 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955068#M66885</guid>
      <dc:creator>VladimirRosu</dc:creator>
      <dc:date>2024-06-07T11:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955083#M66886</link>
      <description>&lt;P&gt;Capability for an infotable is desired which does all the querying in a single statement as opposed to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. SELECT T1.Name FROM Table1&lt;/P&gt;&lt;P&gt;2. SELECT T2.Name FROM Table2&lt;/P&gt;&lt;P&gt;3. Perform join query on above 2 tables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ie we would like to reduce the Select statement cost as it will be expensive in Production.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 11:59:01 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955083#M66886</guid>
      <dc:creator>ashishtamhane</dc:creator>
      <dc:date>2024-06-07T11:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955096#M66888</link>
      <description>&lt;P&gt;Intersect is the snippet to use: &lt;A href="https://www.ptc.com/en/support/article/CS340098?source=search" target="_blank"&gt;https://www.ptc.com/en/support/article/CS340098?source=search&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;But...one very important point: the amount of data that you will retrieve in the beginning. I understand that SELECT could be expensive, but if you're querying (initially) millions of rows that then you keep as infotables, then you'll have an impact on memory...&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 12:32:44 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955096#M66888</guid>
      <dc:creator>VladimirRosu</dc:creator>
      <dc:date>2024-06-07T12:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955125#M66891</link>
      <description>&lt;P&gt;Thats what my query is. Do we have something that selects and joins the data in the same query so as to reduce the amount of rows returned.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 14:49:41 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955125#M66891</guid>
      <dc:creator>ashishtamhane</dc:creator>
      <dc:date>2024-06-07T14:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955133#M66893</link>
      <description>&lt;P&gt;Hi Ashish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not an expert on this, but I can share an example that my team has built.&lt;/P&gt;&lt;P&gt;There are 2 tables in our example : Attributes, and AttributeValues. They each have their own DataShape. The AttributeValue table includes column AttributeUid, which joins on Attributes' Uid. So here is what they did for a Select :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let MyFilter = {
select: [{dataShapeName: 'CompanyNameHere.AttributeValue', fieldName: 'Value'},
{dataShapeName: 'CompanyNameHere.AttributeValue',fieldName: 'AttributeUid'}],
filters: {
filters: [{dataShapeName: 'CompanyNameHere.AttributeValue',fieldName: 'IsProcessed',type: 'EQ',value: 0}]
},
joins: [{type: 'INNER', sourceDataShapeName: 'CompanyNameHere.AttributeValue', sourceFieldName: 'AttributeUid', targetDataShapeName: 'CompanyNameHere.Attribute', targetFieldName: 'Uid'}]
};

result = me.GetManyOf({Filter: MyFilter, DataShapeName: 'CompanyNameHere.AttributeValue'});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe this is the equivalent of this query :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT av.Value, av.AttributeUid
FROM AttributeValues av 
JOIN Attributes a ON a.Uid = av.AttributeUid
WHERE av.IsProcessed = 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let us know if that helps.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:01:46 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/955133#M66893</guid>
      <dc:creator>mstarnaud</dc:creator>
      <dc:date>2024-06-07T15:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Relational join query in ThingWorx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/956816#M66955</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/311621"&gt;@ashishtamhane&lt;/a&gt;&lt;/SPAN&gt; ,&lt;BR /&gt;I wanted to see if you got the help you needed.&lt;BR /&gt;If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.&lt;BR /&gt;Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.&lt;BR /&gt;Of course, if you have more to share on your issue, please pursue the conversation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 20:53:46 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Relational-join-query-in-ThingWorx/m-p/956816#M66955</guid>
      <dc:creator>olivierlp</dc:creator>
      <dc:date>2024-06-17T20:53:46Z</dc:date>
    </item>
  </channel>
</rss>

