Questions Tagged With case-queryhttps://answers.axonivy.com/tags/case-query/?type=rssquestions tagged <span class="tag">case-query</span>enWed, 18 Dec 2019 06:06:38 -0500CaseQuery API with clob fieldhttps://answers.axonivy.com/questions/4287/casequery-api-with-clob-field<p>Hi Team, I try to use CaseQuery API to lazy Case table - ORACLE,</p> <p>but stuck with description field (CLOB)</p> <pre><code>query.orderBy().description().ascending(); </code></pre> <p>SQL generated: ORDER BY IWA_CASEQUERY.DESCRIPTION ASC</p> <p>but I got exception : ORA-00932: inconsistent datatypes: expected - got CLOB</p> <p>Seem it not allow to ORDER BY CLOB field</p> <p>Do we have any solution to fix it with CaseQuery API? like this</p> <pre><code>query.orderBy().description().toString().ascending(); </code></pre> <p>[UPDATE] IVY version : 7.0.13</p>docvominhWed, 18 Dec 2019 06:06:38 -0500https://answers.axonivy.com/questions/4287/casequery-api-with-clob-fieldcase-queryTaskQuery case insensitive searchhttps://answers.axonivy.com/questions/1442/taskquery-case-insensitive-search<p>Hi all,</p> <p>Is it possible to search against String Task properties with a TaskQuery so that the search is performed case insensitive.</p> <pre><code> TaskQuery stringFieldQuery = TaskQuery.create(); stringFieldQuery.where().name().isLike("my task name"); </code> </pre> <p>I would like that such a query returns the tasks which name is "MY Task NAme". Thanks in advance</p> <p>Emmanuel</p>EmmanuelFri, 14 Aug 2015 16:36:27 -0400https://answers.axonivy.com/questions/1442/taskquery-case-insensitive-searchcase-querytaskstask-query`TaskQuery.and(TaskQuery)` and `CaseQuery.and(CaseQuery)` doesn't work with `additionalProperty()`.https://answers.axonivy.com/questions/1337/taskquery-and-taskquery-and-casequery-and-casequery-doesn-t-work-with-additionalproperty<p>On our project, we extensively uses the API <code>TaskQuery</code> and <code>CaseQuery</code> in order to find <code>ITask</code> and <code>ICase</code> respectively. We also make use of the <code>additionalProperty</code> of both <code>ITask</code> and <code>ICase</code> in order to store custom fields.</p> <p>However, we later found out that the method <code>and(TaskQuery</code> and <code>or(TaskQuery)</code> doesn't work with the criteria <code>additionalProperty</code>.</p> <p>Consider the below snippet of code:</p> <pre><code>public List&lt;ITask&gt; findTask() { Ivy.wf().getTaskQueryExecutor() .getResults(TaskQuery.create().where() .state().isEqual(SUSPENDED) .and(hasCustomField())); } private static TaskQuery hasCustomField() { return TaskQuery.create().where().additionalProperty("custom").isLike("customized_value"); } </code></pre> <p>Runing the code will result as an exception:</p> <pre><code>java.sql.SQLException: Column not found: ADDITIONALPROPERTYFORTASK.NAME in statement [SELECT IWA_TASKQUERY.TASKID ....... FROM IWA_TaskQuery WHERE (IWA_TASKQUERY.APPLICATIONID = ? AND (IWA_TASKQUERY."STATE" = ? AND ((ADDITIONALPROPERTYFORTASK.NAME = ? OR ADDITIONALPROPERTYFORTASK.NAME IS NULL) AND ADDITIONALPROPERTYFORTASK."VALUE" LIKE ?))) ORDER BY IWA_TASKQUERY.TASKID ASC] </code></pre> <p>While this works:</p> <pre><code>public List&lt;ITask&gt; findTask() { Ivy.wf().getTaskQueryExecutor() .getResults(TaskQuery.create().where() .state().isEqual(SUSPENDED) .and().additionalProperty("custom").isLike("customized_value"); } </code></pre> <p>Please note that only the criterion <code>additionalPropety()</code> has this problem, the other criteria don't.</p> <p>Digging a little deeper, I found that the queries produced are different:</p> <p>The former (the problematic one) produces:</p> <pre><code>SELECT * FROM IWA_Task WHERE (Column(IWA_TaskQuery.State) = 4 &amp;amp;&amp;amp; ((Column(AdditionalPropertyForTask.Name) = custom || Column(AdditionalPropertyForTask.Name) IS NULL) &amp;amp;&amp;amp; Column(AdditionalPropertyForTask.Value) LIKE customized_value)) </code></pre> <p>...whereas the latter produces (correctly):</p> <pre><code>SELECT * FROM IWA_Task LEFT JOIN IWA_TaskAdditionalProperty ON Column(IWA_TaskQuery.TaskId) = Column(IWA_TaskAdditionalProperty.TaskId) LEFT JOIN IWA_AdditionalProperty ON Column(IWA_TaskAdditionalProperty.AdditionalPropertyId) = Column(IWA_AdditionalProperty.AdditionalPropertyId) WHERE (Column(IWA_TaskQuery.State) = 4 &amp;&amp; (Column(AdditionalPropertyForTask.Name) = custom || Column(AdditionalPropertyForTask.Name) IS NULL) &amp;&amp; Column(AdditionalPropertyForTask.Value) LIKE customized_value) </code></pre> <p>This problem occurs both on <code>TaskQuery</code> and <code>CaseQuery</code> and on Axon.ivy 5.1.x (<code>additionalProperty()</code> has been introduced since 5.1.x).</p> <p>I think this is probrably a bug in Axon.ivy query API. While there is a work-around (don't use <code>and(TaskQuery</code> with <code>additionalProperty()</code>), I think it is not good to have inconsistency in the API. I hope this would be fixed soon.</p> <p>I have created a demo project which can reproduce the problem on Axon.ivy. Download it at <a href="https://app.box.com/s/9wxc8iqqrfmqotljiutqdwlvvoem55dh">box.net</a>.</p>Genzer HawkerWed, 27 May 2015 09:04:31 -0400https://answers.axonivy.com/questions/1337/taskquery-and-taskquery-and-casequery-and-casequery-doesn-t-work-with-additionalpropertyadditional-propertycase-querybugtask-query