<?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: QuerySpec to retrieve the documents using latest modified date in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1057817#M11171</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/913168"&gt;@LT_12699133&lt;/a&gt;&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to see if you got the help you needed.&lt;/P&gt;
&lt;P&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;Of course, if you have more to share on your issue, please pursue the conversation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Anurag&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Mar 2026 17:15:52 GMT</pubDate>
    <dc:creator>anursingh</dc:creator>
    <dc:date>2026-03-09T17:15:52Z</dc:date>
    <item>
      <title>QuerySpec to retrieve the documents using latest modified date</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1050163#M10895</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Description: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Version: Windchill 13.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use Case: Fetch all unique WTDocuments of allowed types, modified on or after a given timestamp, across multiple document types, without duplicates.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Description: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I am using below queryspec however it is not returning the results expected, for example when I do teh search in Windchill advance search it fetched results around 300 but using queryspec it is fetching around 60. I am not sure why this discrepency is happening but please help me if you knwo something here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we can have multiple document type. Also internal name is correct. I have cross checked as well. just fetching few results not entire is confusing me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;List&amp;lt;Long&amp;gt; typeIds = new ArrayList&amp;lt;&amp;gt;();

 System.out.println("getWTDocumentByLastModifiedDate allowedDocumentTypes&amp;gt;&amp;gt;&amp;gt; "+allowedDocumentTypes);

 QuerySpec qs = new QuerySpec(WTDocument.class); 

for (String typeId : allowedDocumentTypes) {

 System.out.println("getWTDocumentByLastModifiedDate typeId&amp;gt;&amp;gt;&amp;gt; "+typeId);

 TypeDefinitionReference tdRef = TypedUtilityServiceHelper.service.getTypeDefinitionReference(typeId.trim());

typeIds.add(tdRef.getKey().getId());

 }



qs.appendOpenParen();

for (int i = 0; i &amp;lt; typeIds.size(); i++) { 

if (i &amp;gt; 0) {

qs.appendOr();

 }

qs.appendWhere(new SearchCondition(WTDocument.class, "typeDefinitionReference.key.id", SearchCondition.EQUAL, typeIds.get(i)), new int[] { 0 });



 }

qs.appendCloseParen();

qs.appendAnd();

qs.appendWhere(new SearchCondition(WTDocument.class, WTDocument.MODIFY_TIMESTAMP, SearchCondition.GREATER_THAN_OR_EQUAL, timestamp), new int[] { 0 });

 QueryResult qr = PersistenceHelper.manager.find((StatementSpec)qs);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 20:35:37 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1050163#M10895</guid>
      <dc:creator>LT_12699133</dc:creator>
      <dc:date>2026-01-07T20:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: QuerySpec to retrieve the documents using latest modified date</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1050178#M10896</link>
      <description>&lt;P&gt;Also, I just found out one thing that it is skipping parts which have modified date end with EDT and selecting only EST one's&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 21:58:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1050178#M10896</guid>
      <dc:creator>LT_12699133</dc:creator>
      <dc:date>2026-01-07T21:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: QuerySpec to retrieve the documents using latest modified date</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1050730#M10919</link>
      <description>&lt;P&gt;If you print out qs.toString() you should be able to see the query it is executing to verify it looks like you want it to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other things to consider....&lt;/P&gt;&lt;P&gt;qs.setDistinct(true);&lt;/P&gt;&lt;P&gt;qs.setDescendantQuery(false);&amp;nbsp; //Explained here &lt;A href="https://www.ptc.com/en/support/article/CS456437" target="_blank"&gt;https://www.ptc.com/en/support/article/CS456437&lt;/A&gt;&amp;nbsp;I always do this when I'm debugging otherwise it's hard to see exactly what the query is with all the other types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2026 20:50:16 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1050730#M10919</guid>
      <dc:creator>jmomber</dc:creator>
      <dc:date>2026-01-13T20:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: QuerySpec to retrieve the documents using latest modified date</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1057817#M11171</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/913168"&gt;@LT_12699133&lt;/a&gt;&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to see if you got the help you needed.&lt;/P&gt;
&lt;P&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;Of course, if you have more to share on your issue, please pursue the conversation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Anurag&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2026 17:15:52 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/QuerySpec-to-retrieve-the-documents-using-latest-modified-date/m-p/1057817#M11171</guid>
      <dc:creator>anursingh</dc:creator>
      <dc:date>2026-03-09T17:15:52Z</dc:date>
    </item>
  </channel>
</rss>

