<?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: Query to retrieve &amp;apos;top level&amp;apos; workspaces in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321104#M8105</link>
    <description>&lt;P&gt;Thank you for your kind reply. I opted for working with the query I had and then just filtered the values using JS, basically the suggestion you gave me without resorting to automation chains&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2019 21:55:09 GMT</pubDate>
    <dc:creator>a_c</dc:creator>
    <dc:date>2019-12-06T21:55:09Z</dc:date>
    <item>
      <title>Query to retrieve &amp;apos;top level&amp;apos; workspaces</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321100#M8101</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;
&lt;P&gt;In the project I'm working on we have a workspace structure where different workspaces are nested, each workspace associated with user groups and read permissions, i.e:&lt;/P&gt;
&lt;P&gt;Workspaceroot
Workspace 1
Workspace 1a
Workspace 1b
Workspace 2
Workspace 2a
Workspace 2b
Workspace 2b-1
Workspace 2b-2
Workspace 3&lt;/P&gt;
&lt;P&gt;User group 1 has permissions on Workspace 1 and its children
User group 2 has permissions on Workspace 2 and its children
User group 2b has permissions on Workspace 2b and its children etc.&lt;/P&gt;
&lt;P&gt;I need to build a query to retrieve only the top level workspaces associated with the user group, without children workspaces. That is, user group 2 should only see Workspace 2 without children, while user group 2b should only get Workspace 2b without parent or children and so on.&lt;/P&gt;
&lt;P&gt;So far I have a query that retrieves workspaces from a path using the STARTSWITH keyword:
&lt;CODE&gt;SELECT * FROM Document WHERE ecm:mixinType != 'HiddenInNavigation' AND ecm:isProxy = 0 AND ecm:isVersion = 0 AND ecm:isTrashed = 0 AND ecm:primaryType='Workspace' and ecm:path STARTSWITH '/default-domain/workspaces' ORDER BY dc:created DESC&lt;/CODE&gt;
But this query retrieves  all workspaces and their children. I also tried using &lt;CODE&gt;ecm:pos = 0&lt;/CODE&gt; but this retrieves null registers.&lt;/P&gt;
&lt;P&gt;Is there a way to limit the search path to only the top level workspaces? Also, if I use the STARTSWITH keyword, how do I make it a dynamic parameter so that user group 2b searches for &lt;CODE&gt;'/default-domain/workspaces/Workspace 2/Workspace 2b'&lt;/CODE&gt;?&lt;/P&gt;
&lt;P&gt;Sorry if I don't make much sense, but I'm new to NXQL queries.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 23:46:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321100#M8101</guid>
      <dc:creator>a_c</dc:creator>
      <dc:date>2019-11-15T23:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve &amp;apos;top level&amp;apos; workspaces</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321101#M8102</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;You need to create workspace subtypes to do so (just a clone is OK).&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2019 21:00:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321101#M8102</guid>
      <dc:creator>Gregory_Carlin</dc:creator>
      <dc:date>2019-11-17T21:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve &amp;apos;top level&amp;apos; workspaces</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321102#M8103</link>
      <description>&lt;P&gt;Thank you for your reply but can you elaborate? I already declared subtypes at the doctype extension point, which as far as I know  are used to determine the types that can be created inside a parent document. But what do you mean with a clone and how would I use it in a query?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2019 16:00:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321102#M8103</guid>
      <dc:creator>a_c</dc:creator>
      <dc:date>2019-11-19T16:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve &amp;apos;top level&amp;apos; workspaces</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321103#M8104</link>
      <description>&lt;P&gt;If I understood the requirement correctly, you would need to query something like
&lt;CODE&gt;SELECT * FROM Workspace WHERE ecm:mixinType != 'HiddenInNavigation' AND ecm:isProxy = 0 AND ecm:isVersion = 0 AND ecm:isTrashed = 0 order by ecm:path&lt;/CODE&gt;
and get only the first result (&lt;CODE&gt;This.get(0)&lt;/CODE&gt; in an automation chain) ... It would retrieve the one document with the shortest path a given user can read.
A bit an overkill given you retrieve all workspaces to keep only 1 in the end.
You can replace the Workspace type with your own derived type.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Nov 2019 16:49:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321103#M8104</guid>
      <dc:creator>Patrick_Abgrall</dc:creator>
      <dc:date>2019-11-30T16:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Query to retrieve &amp;apos;top level&amp;apos; workspaces</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321104#M8105</link>
      <description>&lt;P&gt;Thank you for your kind reply. I opted for working with the query I had and then just filtered the values using JS, basically the suggestion you gave me without resorting to automation chains&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 21:55:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/query-to-retrieve-apos-top-level-apos-workspaces/m-p/321104#M8105</guid>
      <dc:creator>a_c</dc:creator>
      <dc:date>2019-12-06T21:55:09Z</dc:date>
    </item>
  </channel>
</rss>

