<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>a!querylogicalExpression</title><link>https://community.appian.com/discussions/f/rules/24358/a-querylogicalexpression</link><description>I have a query entity where i am passing date column AA to fetch some info from table. Now based on Source,i need to use different date columns. Example: For Source A i have to pass column DateAAAA, for source BB pass DateBBB etc. 
 I dont find a way</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94033?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 15:07:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8abbc365-8b33-473f-b121-ac661fbeb87b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;As you read through the rows of returned data (including the unexpected extras), what rows are being returned that don&amp;#39;t match the desired parameters?&amp;nbsp; In what way do those rows fail to meet your expectations?&amp;nbsp; This is important to know to determine what the issue might be.&amp;nbsp; If you&amp;#39;re able to try again, could you post the full code of that version of the query?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94032?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 14:58:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5f325573-c2d2-44c7-a6c3-3d9f1dbeb199</guid><dc:creator>Malleswari Talakola</dc:creator><description>&lt;p&gt;Hello Mike,&lt;/p&gt;
&lt;p&gt;Thanks for the response.&lt;/p&gt;
&lt;p&gt;I did tried this approach earlier, it is returning me data but instead of 22 it is giving me 49 rows etc which is not appropriate. So i am kind of lost on it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94031?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 14:56:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8e329875-4b75-46d9-a3a2-7e6f9f19d14b</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand why you can&amp;#39;t just use QueryLogicalExpression nesting to accomplish this.&amp;nbsp; Your example code posted above already contains an example of nested QLEs so you already understand how it should be structured.&amp;nbsp; In pseudocode all you&amp;#39;d need to add for the source/date combinations is something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;logicalExpressions: {
  a!queryLogicalExpression(
    operator: &amp;quot;OR&amp;quot;,
    logicalExpressions: {
      
      /* first source */
      a!queryLogicalExpression(
        operator: &amp;quot;AND&amp;quot;,
        filters: {
          /* Query Filter for Source = AAA */
          (...)
          /* Query Filter on Date Field AAA */
          (...)
        }
      ),
      
      /* second source */
      a!queryLogicalExpression(
        operator: &amp;quot;AND&amp;quot;,
        filters: {
          /* Query Filter for Source = BBB */
          (...)
          /* Query Filter on Date Field BBB */
          (...)
        }
      )
    }
  )
},&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94029?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 14:13:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6109554d-ff28-4a68-ba56-889acf9aaa0f</guid><dc:creator>Malleswari Talakola</dc:creator><description>&lt;p&gt;makes sense, now i will look for other options as you mentioned. Thanks a lot for you time and prompt response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks Stefan..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94028?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 14:02:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7c0f0584-9458-415c-8c8f-e8756c5214f9</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;No. In SQL code you can do a subselect and fetching data and use it in a condition. This is not possible in Appian. So putting a queryFilter as a condition into an if statement will not work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94027?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 13:57:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:be80b33e-d066-439f-bd59-d092a5ba52d9</guid><dc:creator>Malleswari Talakola</dc:creator><description>&lt;p&gt;the data returned is just written to&amp;nbsp;another tables but nothing can be done later.&lt;/p&gt;
&lt;p&gt;Let me make it simple, would this type of condition work(not returning correct data)..&lt;/p&gt;
&lt;p&gt;Do i have to write it differently??&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;if(&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;caseSourceRefId&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;lt;&amp;gt;&amp;quot;,&lt;br /&gt; value: cons!FAS_REF_ID_CASE_SOURCE[12],&lt;br /&gt; ),&lt;br /&gt;&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;requestReceivedOn&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;br /&gt; value: gmt(&lt;br /&gt; todatetime(&lt;br /&gt; workday(&lt;br /&gt; local(now(), &amp;quot;America/New_York&amp;quot;),&lt;br /&gt; cons!FAS_MAX_DAYS_TO_INCREASE_PRIORITY,&lt;br /&gt; ri!holidays&lt;br /&gt; ) &amp;amp; &amp;quot; &amp;quot; &amp;amp; totime(&amp;quot;16:00 PM&amp;quot;)&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;requestReceivedDateTimeFromExtSource&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;br /&gt; value: gmt(&lt;br /&gt; todatetime(&lt;br /&gt; workday(&lt;br /&gt; local(now(), &amp;quot;America/New_York&amp;quot;),&lt;br /&gt; cons!FAS_MAX_DAYS_TO_INCREASE_PRIORITY,&lt;br /&gt; ri!holidays&lt;br /&gt; ) &amp;amp; &amp;quot; &amp;quot; &amp;amp; totime(&amp;quot;16:00 PM&amp;quot;)&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94017?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 13:14:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0741b948-014a-4217-8176-d7a759ae625e</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;This is very confusing ...&lt;/p&gt;
&lt;p&gt;What do you do with the returned data? Would it be an option to just fetch both fields and decide later in the logic?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94016?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 13:03:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bf20f6bb-499b-42d2-9581-8c2296a2f000</guid><dc:creator>Malleswari Talakola</dc:creator><description>&lt;p&gt;i am adding the actual code i am using for additional info, please check....&lt;/p&gt;
&lt;p&gt;ri!&lt;span&gt;dailyPriorityCriteria would just get the cases based on the filters we pass above..&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;IN this code, we only have the filetes for requestReceivedOn date field, now we have new field &amp;quot;requestReceivedfromexternalsource&amp;quot; which is specific to some sources.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1650632918450v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!queryEntity(
  entity: cons!FAS_DSE_CASE,
  query: a!query(
    selection: a!querySelection(
      columns: {
        a!queryColumn(field: &amp;quot;id&amp;quot;),
        a!queryColumn(field: &amp;quot;clientTypeRefId&amp;quot;),
        a!queryColumn(field: &amp;quot;transactionRefId&amp;quot;),
        a!queryColumn(field: &amp;quot;transactionSubRefId&amp;quot;),
        a!queryColumn(field: &amp;quot;priority&amp;quot;),
        a!queryColumn(field: &amp;quot;requestReceivedOn&amp;quot;),
        a!queryColumn(field: &amp;quot;requestReceivedOn&amp;quot;)
      }
    ),
    logicalExpression: a!queryLogicalExpression(
      operator: &amp;quot;AND&amp;quot;,
      filters: {
        a!queryFilter(
          field: &amp;quot;caseStatusRefId&amp;quot;,
          operator: &amp;quot;&amp;lt;&amp;gt;&amp;quot;,
          value: cons!FAS_REF_ID_CASE_STATUS[3]
        ),
        a!queryFilter(
          field: &amp;quot;caseStatusRefId&amp;quot;,
          operator: &amp;quot;&amp;lt;&amp;gt;&amp;quot;,
          value: cons!FAS_REF_ID_CASE_STATUS[4]
        ),
        /*FROM: created 10 bus days ago at 00:00am*/
        a!queryFilter(
          field: &amp;quot;requestReceivedOn&amp;quot;,
          operator: &amp;quot;&amp;gt;=&amp;quot;,
          value: gmt(
            todatetime(
              workday(
                local(now(), &amp;quot;America/New_York&amp;quot;),
                cons!FAS_MAX_DAYS_TO_INCREASE_PRIORITY,
                ri!holidays
              ) &amp;amp; &amp;quot; &amp;quot; &amp;amp; totime(&amp;quot;16:00 PM&amp;quot;)
            )
          )
        ),
        /*UP TO: created 1 bus days ago at 23:59pm*/
        a!queryFilter(
          field: &amp;quot;requestReceivedOn&amp;quot;,
          operator: &amp;quot;&amp;lt;&amp;quot;,
          value: gmt(
            todatetime(
              workday(
                local(now(), &amp;quot;America/New_York&amp;quot;),
                - 1,
                ri!holidays
              ) &amp;amp; &amp;quot; &amp;quot; &amp;amp; totime(&amp;quot;16:00 PM&amp;quot;)
            )
          )
        )
      },
      logicalExpressions: {
        a!queryLogicalExpression(
          operator: &amp;quot;OR&amp;quot;,
          logicalExpressions: {
            a!forEach(
              items: ri!dailyPriorityCriteria,
              expression: {
                a!queryLogicalExpression(
                  operator: &amp;quot;AND&amp;quot;,
                  filters: {
                    a!queryFilter(
                      field: &amp;quot;clientTypeRefId&amp;quot;,
                      operator: if(
                        rule!APN_isEmpty(fv!item.clientTypeRefId),
                        &amp;quot;is null&amp;quot;,
                        &amp;quot;=&amp;quot;
                      ),
                      value: fv!item.clientTypeRefId
                    ),
                    a!queryFilter(
                      field: &amp;quot;transactionRefId&amp;quot;,
                      operator: &amp;quot;=&amp;quot;,
                      value: fv!item.transactionRefId
                    ),
                    a!queryFilter(
                      field: &amp;quot;transactionSubRefId&amp;quot;,
                      operator: &amp;quot;=&amp;quot;,
                      value: fv!item.transactionSubRefId
                    ),
                    a!queryFilter(
                      field: &amp;quot;priority&amp;quot;,
                      operator: &amp;quot;&amp;lt;&amp;quot;,
                      value: tointeger(fv!item.startingPriority) + tointeger(
                        sum(
                          reject(
                            isnull(_),
                            {
                              fv!item.increaseDay1,
                              fv!item.increaseDay2,
                              fv!item.increaseDay3,
                              fv!item.increaseDay4,
                              fv!item.increaseDay5,
                              fv!item.increaseDay6,
                              fv!item.increaseDay7,
                              fv!item.increaseDay8,
                              fv!item.increaseDay9,
                              fv!item.increaseDay10
                            }
                          )
                        )
                      )
                    )
                  }
                )/*END AND*/
                
              }
            )/*END FOR EACH*/
            
          }
        )/*END OR*/
        
      },
      ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: cons!FAS_MAX_CASES_TO_INCREASE_PRIORITY
    )
  ),
  fetchTotalCount: false
).data&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94015?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 13:02:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:14808c3a-7ce6-4c56-8927-50a44c9220cd</guid><dc:creator>Malleswari Talakola</dc:creator><description>&lt;p&gt;Hello Stefan,&lt;/p&gt;
&lt;p&gt;Thank you for the response.&lt;/p&gt;
&lt;p&gt;Source is another column in the same Table and coming from table in this case. So i have columns... &amp;quot;Source&amp;quot;, &amp;quot;DateFieldAAA&amp;quot;, &amp;quot;DateFieldBBB&amp;quot; etc.&lt;/p&gt;
&lt;p&gt;When Source = AAA, query filter on &amp;quot;DateFieldAAA&amp;quot; and when source = BBB, query filter on &amp;quot;DateFieldBBB&amp;quot;.&lt;/p&gt;
&lt;p&gt;Even to use applywhen() condition, i have to first get the source.&lt;/p&gt;
&lt;p&gt;i tries something like this, which i am sure would not help me.&lt;/p&gt;
&lt;p&gt;a added a!queryselection(column: &amp;quot;source&amp;quot;), and under filters:&lt;/p&gt;
&lt;p&gt;if(&lt;/p&gt;
&lt;p&gt;a!queryFilter(&lt;br /&gt; field: &amp;quot;source&amp;quot;,&lt;br /&gt; operator: &amp;quot;=&amp;quot;,&lt;br /&gt; value: &amp;quot;AAA&amp;quot;&lt;br /&gt; ),&lt;/p&gt;
&lt;p&gt;a!queryFilter(&lt;br /&gt; field: &amp;quot;&lt;span&gt;DateFieldBBB&lt;/span&gt;&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;br /&gt; value: gmt(&lt;br /&gt; todatetime(&lt;br /&gt; workday(&lt;br /&gt; local(now(), &amp;quot;America/New_York&amp;quot;),&lt;br /&gt; -10,&lt;br /&gt; ri!holidays&lt;br /&gt; ) &amp;amp; &amp;quot; &amp;quot; &amp;amp; totime(&amp;quot;16:00 PM&amp;quot;)&lt;br /&gt; )&lt;br /&gt; ),&lt;/p&gt;
&lt;p&gt;&lt;span&gt;a!queryFilter(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;field: &amp;quot;&lt;/span&gt;&lt;span&gt;DateFieldAAA&lt;/span&gt;&lt;span&gt;&amp;quot;,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;value: gmt(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;todatetime(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;workday(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local(now(), &amp;quot;America/New_York&amp;quot;),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;-10,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;ri!holidays&lt;/span&gt;&lt;br /&gt;&lt;span&gt;) &amp;amp; &amp;quot; &amp;quot; &amp;amp; totime(&amp;quot;16:00 PM&amp;quot;)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;),&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/94004?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 09:20:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e6504d7a-1024-467e-9015-f487313eaf3f</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Using a simple applyWhen would allow you to enable certain filters on conditions. My question is: How is this &amp;quot;source&amp;quot; defined and where is the value coming from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/93998?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 04:51:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3aa457af-ecaa-44d8-afcb-d5a70b7c41e1</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Hi Naresh. Suggest as the answer is a function you use when you think this is the answer to the question asked,&amp;nbsp;&lt;br /&gt;In your case, you are just raising another question and marking it as a suggested answer. Please keep the community clean and avoid such practices.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!querylogicalExpression</title><link>https://community.appian.com/thread/93976?ContentTypeID=1</link><pubDate>Fri, 22 Apr 2022 00:10:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fb8175a6-fc8a-4aa7-9bdd-5799aa148a92</guid><dc:creator>Naresh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you trying to filter or query data based on the selected source. Provide some additional details why you want to filter data based on source?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>