<?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: TaskQuery count mismatch in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216436#M169566</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;B&gt;agarwalnitish18 _&lt;/B&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per java doc of TaskQuery and TaskInfoQuery (&lt;A class="link-titled" href="https://www.activiti.org/javadocs/org/activiti/engine/task/TaskInfoQuery.html#taskCategory-java.lang.String-" title="https://www.activiti.org/javadocs/org/activiti/engine/task/TaskInfoQuery.html#taskCategory-java.lang.String-" rel="nofollow noopener noreferrer"&gt;TaskInfoQuery (Activiti - Engine 5.22.0 API)&lt;/A&gt;, taskQuery.taskCategory(String category) will allow the query to search for tasks with the given category only. The task category is defined within the task attribute as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Task category defined in GUI" class="image-1 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11873_taskcategoryGUI.png" style="width: 620px; height: 369px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="task category defined in XML" class="image-2 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11874_taskCategoryXML.png" style="width: 620px; height: 165px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So a query such as this should return all tasks that has category 'review' and are active.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;query = taskService.createTaskQuery().taskCategory("&lt;STRONG style="color: #ff6600;"&gt;review&lt;/STRONG&gt;").active().orderByTaskCreateTime().desc()&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;.includeProcessVariables();&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Your query doesn't look correct except you do have category 'incomplete' defined for your tasks which doesn't sound right. I believe you are looking for active tasks which is already handled by .active().&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Per Activiti java doc (&lt;A class="link-titled" href="https://www.activiti.org/javadocs/org/activiti/engine/query/Query.html#count--" title="https://www.activiti.org/javadocs/org/activiti/engine/query/Query.html#count--" rel="nofollow noopener noreferrer"&gt;Query (Activiti - Engine 5.22.0 API)&lt;/A&gt;&amp;nbsp;, count() will run your query and return the number of results and list() will return the list of entities the query could find. So they should return the same number. I attached my unit test which shows taskQuery.count() and taskQuery.list.size() returns the same value. Here's a snippet of the unit test log. I attached the full log as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;INFO: Initializing process instance: 5&lt;BR /&gt;INFO: Initializing process instance: 21&lt;BR /&gt;Jan 04, 2017 1:21:40 PM java.util.logging.LogManager$RootLogger log&lt;BR /&gt;INFO: Process execution: id: 5 and current activity id= usertask2&lt;BR /&gt;Jan 04, 2017 1:21:40 PM java.util.logging.LogManager$RootLogger log&lt;BR /&gt;INFO: &lt;SPAN style="color: #ff6600;"&gt;Task query count: 2&lt;/SPAN&gt;&lt;BR /&gt;Jan 04, 2017 1:21:40 PM java.util.logging.LogManager$RootLogger log&lt;BR /&gt;INFO: &lt;SPAN style="color: #ff6600;"&gt;Task query list size: 2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;BR /&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Thong Huynh&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jan 2017 06:30:46 GMT</pubDate>
    <dc:creator>thuynh</dc:creator>
    <dc:date>2017-01-04T06:30:46Z</dc:date>
    <item>
      <title>TaskQuery count mismatch</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216434#M169564</link>
      <description>HI,I am using activti 5.21 and executing th below query.query = taskService.createTaskQuery().taskCategory("incomplete").active().orderByTaskCreateTime().desc() .includeProcessVariables();if i do query.count(),its returning me count as 667, but when i do quey.list().size(), its returning me 376.I am</description>
      <pubDate>Wed, 28 Dec 2016 06:17:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216434#M169564</guid>
      <dc:creator>agarwalnitish18</dc:creator>
      <dc:date>2016-12-28T06:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: TaskQuery count mismatch</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216435#M169565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kindly take a look at&amp;nbsp;&lt;A __default_attr="226505" __jive_macro_name="thread" _jive_internal="true" class="jive_macro_thread jive_macro link-titled" href="https://community.alfresco.com/thread/226505-query-list-returning-wrong-size-when-used-with-parameter-includeprocessvariables-or-includetasklocalvariables" rel="nofollow noopener noreferrer"&gt;&lt;/A&gt;&amp;nbsp;, it looks similar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 15:24:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216435#M169565</guid>
      <dc:creator>romschn</dc:creator>
      <dc:date>2016-12-29T15:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: TaskQuery count mismatch</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216436#M169566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;B&gt;agarwalnitish18 _&lt;/B&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per java doc of TaskQuery and TaskInfoQuery (&lt;A class="link-titled" href="https://www.activiti.org/javadocs/org/activiti/engine/task/TaskInfoQuery.html#taskCategory-java.lang.String-" title="https://www.activiti.org/javadocs/org/activiti/engine/task/TaskInfoQuery.html#taskCategory-java.lang.String-" rel="nofollow noopener noreferrer"&gt;TaskInfoQuery (Activiti - Engine 5.22.0 API)&lt;/A&gt;, taskQuery.taskCategory(String category) will allow the query to search for tasks with the given category only. The task category is defined within the task attribute as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Task category defined in GUI" class="image-1 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11873_taskcategoryGUI.png" style="width: 620px; height: 369px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="task category defined in XML" class="image-2 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11874_taskCategoryXML.png" style="width: 620px; height: 165px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So a query such as this should return all tasks that has category 'review' and are active.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;query = taskService.createTaskQuery().taskCategory("&lt;STRONG style="color: #ff6600;"&gt;review&lt;/STRONG&gt;").active().orderByTaskCreateTime().desc()&lt;/SPAN&gt;&lt;BR style="color: #727174; background-color: #ffffff;" /&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;.includeProcessVariables();&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Your query doesn't look correct except you do have category 'incomplete' defined for your tasks which doesn't sound right. I believe you are looking for active tasks which is already handled by .active().&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Per Activiti java doc (&lt;A class="link-titled" href="https://www.activiti.org/javadocs/org/activiti/engine/query/Query.html#count--" title="https://www.activiti.org/javadocs/org/activiti/engine/query/Query.html#count--" rel="nofollow noopener noreferrer"&gt;Query (Activiti - Engine 5.22.0 API)&lt;/A&gt;&amp;nbsp;, count() will run your query and return the number of results and list() will return the list of entities the query could find. So they should return the same number. I attached my unit test which shows taskQuery.count() and taskQuery.list.size() returns the same value. Here's a snippet of the unit test log. I attached the full log as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;INFO: Initializing process instance: 5&lt;BR /&gt;INFO: Initializing process instance: 21&lt;BR /&gt;Jan 04, 2017 1:21:40 PM java.util.logging.LogManager$RootLogger log&lt;BR /&gt;INFO: Process execution: id: 5 and current activity id= usertask2&lt;BR /&gt;Jan 04, 2017 1:21:40 PM java.util.logging.LogManager$RootLogger log&lt;BR /&gt;INFO: &lt;SPAN style="color: #ff6600;"&gt;Task query count: 2&lt;/SPAN&gt;&lt;BR /&gt;Jan 04, 2017 1:21:40 PM java.util.logging.LogManager$RootLogger log&lt;BR /&gt;INFO: &lt;SPAN style="color: #ff6600;"&gt;Task query list size: 2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Hope this helps,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;BR /&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;Thong Huynh&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #727174; background-color: #ffffff;"&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2017 06:30:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/taskquery-count-mismatch/m-p/216436#M169566</guid>
      <dc:creator>thuynh</dc:creator>
      <dc:date>2017-01-04T06:30:46Z</dc:date>
    </item>
  </channel>
</rss>

