<?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>query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/discussions/f/data/11826/query-needs-to-be-dynamically-created-based-on-the-search-fields-using-a-queryentity</link><description>Hi , 
 I have an action where user can do multiple search options to get the related data from DB as below 
 
 
 
 I am facing an issue in amending the following section queries and based on the user enterable values , the following query needs to be</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52626?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2018 06:12:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3c1cc22e-4a93-44ea-af78-c44a7a48d8a5</guid><dc:creator>Soujanya B</dc:creator><description>a1 = a2 are the values of column TWP (start range and end range)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52612?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2018 21:06:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:503cdd0c-c368-4f61-9fcb-f73f227f79c8</guid><dc:creator>Ram</dc:creator><description>Correct me if I am wrong, a1 &amp;amp; a2 are variables which hold values right. And in your above mentioned query you are comparing a1 with a2 and the outcome will be a Boolean. &lt;br /&gt;
&lt;br /&gt;
My question is after you get this Boolean with which database column or field are you going to compare it with.&lt;br /&gt;
&lt;br /&gt;
Could you please specify the value which takes a1=a2 outcome as input.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52609?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2018 18:20:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:82ad7851-63db-4a48-a0e9-0ac5371baa0b</guid><dc:creator>Soujanya B</dc:creator><description>&lt;p&gt;Hi ,&lt;br /&gt; &lt;br /&gt; How can we form the below condition(a1=a2) in the query using logical expression and filter&lt;br /&gt; &lt;br /&gt; select * from vw_rtrr_wellreport&lt;br /&gt; where (TWP &amp;gt;= a1 and RGE &amp;gt;= b1 and MER &amp;gt;= b2 and TWP &amp;lt; a2) &lt;br /&gt; or (TWP &amp;gt; a1 and TWP &amp;lt;= a2 and RGE &amp;lt;= b1 and MER &amp;lt;= b2)&lt;br /&gt; or (TWP = a1 and&lt;em&gt;&lt;strong&gt; a1 = a2&lt;/strong&gt;&lt;/em&gt; and RGE &amp;gt;= b1 and MER &amp;gt;= b2 and RGE &amp;lt;= b1 and MER &amp;lt;= b2) &lt;br /&gt; )&lt;pre class="ui-code" data-mode="text"&gt; a!queryLogicalExpression(
 operator: &amp;quot;OR&amp;quot;,
 logicalExpressions: {
   
   a!queryLogicalExpression(
 operator: &amp;quot;AND&amp;quot;,
 filters:{
   
   if(
 rule!APN_isEmpty(
 ri!DLSSearch
 ),
 &amp;quot;&amp;quot;,
 {
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;&amp;gt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;RGEStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;RGE&amp;quot;,
 operator: &amp;quot;&amp;gt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;RGEStart&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;MER&amp;quot;,
 operator: &amp;quot;&amp;gt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;&amp;lt;&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 )
 )
 })
 }
 )
 ,
   a!queryLogicalExpression(
 operator: &amp;quot;AND&amp;quot;,
 filters:{
   
   if(
 rule!APN_isEmpty(
 ri!DLSSearch
 ),
 &amp;quot;&amp;quot;,
 {
   
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;&amp;gt;&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 )
 ),
 
  
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;RGEStart,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;RGE&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;RGEStart&amp;quot;,
 {}
 )
 )
 ),
 if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;MEREnd,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;MER&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 )
 )
 })
 }
 ),
    
   a!queryLogicalExpression(
 operator: &amp;quot;AND&amp;quot;,
 filters:{
   
   if(
 rule!APN_isEmpty(
 ri!DLSSearch
 ),
 &amp;quot;&amp;quot;,
 {
   
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;RGEEnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;RGE&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;RGEEnd&amp;quot;,
 {}
 )
 )
 ),
 if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;MER&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 )
 )
 })
 }
 )
}
)
 
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52562?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2018 19:21:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6328f6e4-c2cf-435c-8536-54d7f418da87</guid><dc:creator>Soujanya B</dc:creator><description>Thanks! got it&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52478?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2018 17:23:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:068b0582-c4ec-4fc7-888f-de34b0e81308</guid><dc:creator>Ram</dc:creator><description>Please use the below code for casting the local variable to the specified cdt type.&lt;br /&gt;
&lt;br /&gt;
fn!cast(&lt;br /&gt;
    fn!typeof({type!RTRR_DLSSearch()}),&lt;br /&gt;
    /* enter your local varible here*/&lt;br /&gt;
  )&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52460?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2018 07:39:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:008e2c5b-acc5-472c-ac08-3a48f2051af7</guid><dc:creator>Soujanya B</dc:creator><description>Hi,&lt;br /&gt;
&lt;br /&gt;
I wan to declare a local variable of type RTRR_DLSSearch (CDT attached above) in an interface&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52365?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2018 13:21:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:861a9b61-3b0e-4113-aec9-c74bf4acecd6</guid><dc:creator>Ram</dc:creator><description>I was checking your code good to hear that&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52364?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2018 13:19:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:916bf72b-299d-4835-b689-a0af5dcc9742</guid><dc:creator>Soujanya B</dc:creator><description>It working..&lt;br /&gt;
I have declared the cdt type as array in rule input to subrule.r&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52363?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2018 13:13:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1a5dae2d-83c9-41d9-aba5-e579e23f8091</guid><dc:creator>Soujanya B</dc:creator><description>&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/16/CDT.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/16/CDT.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;RTRR_DLSSearch - subrule&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; a!queryLogicalExpression(
 operator: &amp;quot;OR&amp;quot;,
 logicalExpressions: {
   
   a!queryLogicalExpression(
 operator: &amp;quot;AND&amp;quot;,
 filters:{
   
   if(
 rule!APN_isEmpty(
 ri!DLSSearch
 ),
 &amp;quot;&amp;quot;,
 {
   
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;RGEStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;RGE&amp;quot;,
 operator: &amp;quot;&amp;gt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;RGEStart&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;MERStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;MER&amp;quot;,
 operator: &amp;quot;&amp;gt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;MERStart&amp;quot;,
 {}
 )
 )
 )
 })
 }
 ),
   a!queryLogicalExpression(
 operator: &amp;quot;AND&amp;quot;,
 filters:{
   
   if(
 rule!APN_isEmpty(
 ri!DLSSearch
 ),
 &amp;quot;&amp;quot;,
 {
   
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;&amp;gt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPStart&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 )
 )
 })
 }
 ),
    
   a!queryLogicalExpression(
 operator: &amp;quot;AND&amp;quot;,
 filters:{
   
   if(
 rule!APN_isEmpty(
 ri!DLSSearch
 ),
 &amp;quot;&amp;quot;,
 {
   
   if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;TWP&amp;quot;,
 operator: &amp;quot;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;TWPEnd&amp;quot;,
 {}
 )
 )
 ),
  if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;RGEEnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;RGE&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;RGEEnd&amp;quot;,
 {}
 )
 )
 ),
 if(
 rule!APN_isEmpty(
 index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 ),
 &amp;quot;&amp;quot;,
 a!queryFilter(
 field: &amp;quot;MER&amp;quot;,
 operator: &amp;quot;&amp;lt;=&amp;quot;,
 value: index(
 ri!DLSSearch,
 &amp;quot;MEREnd&amp;quot;,
 {}
 )
 )
 )
 })
 }
 )
}
)
 
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;MAin rule&lt;/p&gt;
&lt;p&gt;====&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;= load(
  local!gridSelection: a!gridSelection(
    pagingInfo: rule!RTRR_getDefaultPagingInfo(
      null
    )
  ),
  local!defaultGridSelection: a!gridSelection(
    pagingInfo: rule!RTRR_getDefaultPagingInfo(
      null
    )
  ),
  local!selectedWellboreId_int,
  local!UWISearch_txt:if(ri!reentry=true,ri!UWI_txt,&amp;quot;&amp;quot;),
  local!wellNameSearch_txt:if(ri!reentry=true,ri!wellName_txt,&amp;quot;&amp;quot;),
  local!licenseNoSearch_txt:if(ri!reentry=true,ri!licenseNo_txt,&amp;quot;&amp;quot;),
  local!decisionRequiredBy_date,
  local!decisionRequiredBySearch_date,
  local!businessUnitTokenArray_txt,
  local!businessUnitSearchArray_txt:if(ri!reentry=true,ri!businessUnitArray_txt,&amp;quot;&amp;quot;),
  local!operatingDistrictTokenArray_txt,
  local!operatingDistrictSearchArray_txt:if(ri!reentry=true,ri!operatingDistrictArray_txt,&amp;quot;&amp;quot;),
  local!AMUTokenArray_txt,
  local!AMUSearchArray_txt:if(ri!reentry=true,ri!AMUArray_txt,&amp;quot;&amp;quot;),
  local!provinceTokenArray_txt,
  local!provinceSearchArray_txt:if(ri!reentry=true,ri!provinceArray_txt,&amp;quot;&amp;quot;),
  local!decisionRequiredByBeginSearch_date:if(ri!reentry=true,ri!decisionRequiredByBegin_date,&amp;quot;&amp;quot;),
  local!decisionRequiredByEndSearch_date:if(ri!reentry=true,ri!decisionRequiredByEnd_date,&amp;quot;&amp;quot;),
  local!abandonByDateOperatorSearch_txt:if(ri!reentry=true,ri!abandonByDateOperator_txt,&amp;quot;&amp;quot;),
  local!abandonByDateBeginSearch_date:if(ri!reentry=true,ri!abandonByDateBegin_date,&amp;quot;&amp;quot;),
  local!abandonByDateEndSearch_date:if(ri!reentry=true,ri!abandonByDateEnd_date,&amp;quot;&amp;quot;),
  local!operatorSearch_txt:if(ri!reentry=true,ri!operator_txt,&amp;quot;&amp;quot;),
  local!wellStatusSearch_txt:if(ri!reentry=true,ri!wellStatus_txt,&amp;quot;&amp;quot;),
  local!abandonByReasonSearch_txt:if(ri!reentry=true,ri!abandonByReason_txt,&amp;quot;&amp;quot;),
  local!searchchoice:if(ri!reentry=true,ri!searchchoice,&amp;quot;&amp;quot;),
  local!range:if(ri!reentry=true,ri!range,&amp;quot;&amp;quot;),
  local!TWPStart:if(ri!reentry=true,ri!TWPStart,&amp;quot;&amp;quot;),
  local!Twpend:if(ri!reentry=true,ri!Twpend,&amp;quot;&amp;quot;),
  local!RangedStart:if(ri!reentry=true,ri!RangedStart,&amp;quot;&amp;quot;),
  local!rangeend:if(ri!reentry=true,ri!rangeend,&amp;quot;&amp;quot;),
  local!meridianStart:if(ri!reentry=true,ri!meridianStart,&amp;quot;&amp;quot;),
  local!meridianend:if(ri!reentry=true,ri!meridianend,&amp;quot;&amp;quot;),
  local!Blkstart:if(ri!reentry=true,ri!Blkstart,&amp;quot;&amp;quot;),
  local!sheetsart:if(ri!reentry=true,ri!sheetsart,&amp;quot;&amp;quot;),
  local!sheetend:if(ri!reentry=true,ri!sheetend,&amp;quot;&amp;quot;),
  local!PTNStart:if(ri!reentry=true,ri!PTNStart,&amp;quot;&amp;quot;),
  local!PTNend:if(ri!reentry=true,ri!PTNend,&amp;quot;&amp;quot;),
  local!Subdstart:if(ri!reentry=true,ri!Subdstart,&amp;quot;&amp;quot;),
  local!Subdend:if(ri!reentry=true,ri!Subdend,&amp;quot;&amp;quot;),
  local!Blkend:if(ri!reentry=true,ri!Blkend,&amp;quot;&amp;quot;),
  local!SelectedWellList: {},
  local!decision_txt: &amp;quot;Retire&amp;quot;,
  local!showSearchFields:not(ri!reentry),
  local!decisionComments_txt,
  ri!operator_txt: &amp;quot;Between&amp;quot;,
    ri!abandonByDateOperator_txt: &amp;quot;Between&amp;quot;,
  with(
    a!formLayout(
      label: &amp;quot;Select Wells to Retain or Retire&amp;quot;,
      firstColumnContents: {
        if(
          local!showSearchFields=true,
          {
            a!sectionLayout(
              label: &amp;quot;Search Fields&amp;quot;,
              firstColumnContents: {
                a!textField(
                  label: &amp;quot;Well Name&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  value: ri!wellName_txt,
                  saveInto: ri!wellName_txt
                ),
                a!textField(
                  label: &amp;quot;UWI&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  value: ri!UWI_txt,
                  saveInto: ri!UWI_txt
                ),
                a!dropdownField(
                  label: &amp;quot;Decision Required By Date&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  choiceLabels: {
                    &amp;quot;After&amp;quot;,
                    &amp;quot;Before&amp;quot;,
                    &amp;quot;Between&amp;quot;
                  },
                  placeholderLabel: cons!GLOB_LABEL_DROPDOWN_PLACEHOLDER,
                  choiceValues: {
                    &amp;quot;After&amp;quot;,
                    &amp;quot;Before&amp;quot;,
                    &amp;quot;Between&amp;quot;
                  },
                  value: ri!operator_txt,
                  saveInto: ri!operator_txt
                ),
                if(
                  ri!operator_txt = &amp;quot;Between&amp;quot;,
                  {
                    a!dateField(
                      label: &amp;quot;From&amp;quot;,
                      labelPosition: &amp;quot;ADJACENT&amp;quot;,
                      value: ri!decisionRequiredByBegin_date,
                      saveInto: ri!decisionRequiredByBegin_date
                    ),
                    a!dateField(
                      label: &amp;quot;To&amp;quot;,
                      labelPosition: &amp;quot;ADJACENT&amp;quot;,
                      value: ri!decisionRequiredByEnd_date,
                      saveInto: ri!decisionRequiredByEnd_date
                    )
                  },
                  if(
                    ri!operator_txt = &amp;quot;After&amp;quot;,
                    a!dateField(
                      label: &amp;quot;From&amp;quot;,
                      labelPosition: &amp;quot;ADJACENT&amp;quot;,
                      value: ri!decisionRequiredByBegin_date,
                      saveInto: ri!decisionRequiredByBegin_date
                    ),
                    if(
                      ri!operator_txt = &amp;quot;Before&amp;quot;,
                      a!dateField(
                        label: &amp;quot;To&amp;quot;,
                        labelPosition: &amp;quot;ADJACENT&amp;quot;,
                        value: ri!decisionRequiredByEnd_date,
                        saveInto: ri!decisionRequiredByEnd_date
                      ),
                      {}
                    )
                  )
                )
              },
              secondColumnContents: {
                a!textField(
                  label: &amp;quot;License Number&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  value: ri!licenseNo_txt,
                  saveInto: ri!licenseNo_txt
                ),
                a!textField(
                  label: &amp;quot;Well Status&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  value: ri!wellStatus_txt,
                  saveInto: ri!wellStatus_txt
                ),
                a!dropdownField(
                  label: &amp;quot;Abandon By Date&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  choiceLabels: {
                    &amp;quot;After&amp;quot;,
                    &amp;quot;Before&amp;quot;,
                    &amp;quot;Between&amp;quot;
                  },
                  placeholderLabel: cons!GLOB_LABEL_DROPDOWN_PLACEHOLDER,
                  choiceValues: {
                    &amp;quot;After&amp;quot;,
                    &amp;quot;Before&amp;quot;,
                    &amp;quot;Between&amp;quot;
                  },
                  value: ri!abandonByDateOperator_txt,
                  saveInto: ri!abandonByDateOperator_txt
                ),
                if(
                  ri!abandonByDateOperator_txt = &amp;quot;Between&amp;quot;,
                  {
                    a!dateField(
                      label: &amp;quot;From&amp;quot;,
                      labelPosition: &amp;quot;ADJACENT&amp;quot;,
                      value: ri!abandonByDateBegin_date,
                      saveInto: ri!abandonByDateBegin_date
                    ),
                    a!dateField(
                      label: &amp;quot;To&amp;quot;,
                      labelPosition: &amp;quot;ADJACENT&amp;quot;,
                      value: ri!abandonByDateEnd_date,
                      saveInto: ri!abandonByDateEnd_date
                    )
                  },
                  if(
                    ri!abandonByDateOperator_txt = &amp;quot;After&amp;quot;,
                    a!dateField(
                      label: &amp;quot;From&amp;quot;,
                      labelPosition: &amp;quot;ADJACENT&amp;quot;,
                      value: ri!abandonByDateBegin_date,
                      saveInto: ri!abandonByDateBegin_date
                    ),
                    if(
                      ri!abandonByDateOperator_txt = &amp;quot;Before&amp;quot;,
                      a!dateField(
                        label: &amp;quot;To&amp;quot;,
                        labelPosition: &amp;quot;ADJACENT&amp;quot;,
                        value: ri!abandonByDateEnd_date,
                        saveInto: ri!abandonByDateEnd_date
                      ),
                      {}
                    )
                  )
                ),
                a!dropdownField(
                  label: &amp;quot;Abandon By Date Reason&amp;quot;,
                  labelPosition: &amp;quot;ADJACENT&amp;quot;,
                  choiceLabels: {
                    cons!RTRR_LABELS_ABANDON_BY_REASONS
                  },
                  placeholderLabel: cons!GLOB_LABEL_DROPDOWN_PLACEHOLDER,
                  choiceValues: {
                    cons!RTRR_LABELS_ABANDON_BY_REASONS
                  },
                  value: ri!abandonByReason_txt,
                  saveInto: ri!abandonByReason_txt
                )
              }
            ),
            a!sectionLayout(
              firstColumnContents: {
                rule!RTRR_ComponentBusinessUnitMultiSelect(
                  businessUnitArray_txt: ri!businessUnitArray_txt
                )
              },
              secondColumnContents: {
                rule!GLOB_EditableGridSingleTextColumn(
                  columnHeader_txt: &amp;quot;Operating District&amp;quot;,
                  itemsArray_txt: ri!operatingDistrictArray_txt,
                  itemsTokenArray_txt: local!operatingDistrictTokenArray_txt,
                  linkLabel_txt: &amp;quot;+Add Operating District&amp;quot;
                )
              }
            ),
            a!sectionLayout(
              firstColumnContents: {
                rule!GLOB_EditableGridSingleTextColumn(
                  columnHeader_txt: &amp;quot;AMU&amp;quot;,
                  itemsArray_txt: ri!AMUArray_txt,
                  itemsTokenArray_txt: local!AMUTokenArray_txt,
                  linkLabel_txt: &amp;quot;+Add AMU&amp;quot;
                )
              },
              secondColumnContents: {
                a!multipleDropdownField(
                  label: &amp;quot;Province&amp;quot;,
                  choiceLabels: {
                    cons!RTRR_LABEL_DROPDOWN_PROVINCE
                  },
                  choiceValues: {
                    cons!RTRR_LABEL_DROPDOWN_PROVINCE
                  },
                  value: ri!provinceArray_txt,
                  saveInto: ri!provinceArray_txt
                )
              }
            ),
            a!sectionLayout(
              label : &amp;quot;Select By Location&amp;quot;,
              firstColumnContents: {
                a!radioButtonField(
                  label:&amp;quot;&amp;quot;,
                  choiceLabels: {&amp;quot;DLS&amp;quot;,&amp;quot;NTS&amp;quot;},
                  choiceValues: {&amp;quot;DLS&amp;quot;,&amp;quot;NTS&amp;quot;},
                  value:ri!searchchoice,
                  saveInto:ri!searchchoice
                )}
                ),
             
if(ri!searchchoice=&amp;quot;DLS&amp;quot;,rule!RTRR_GRIDComponentDLS(range:local!range,TWPbegin:local!TWPStart,rangedbegin:local!RangedStart,
Merbegin:local!meridianStart,
Twpend:local!Twpend,rangedend:local!rangeend,merend:local!meridianend
),{}),
if(ri!searchchoice=&amp;quot;NTS&amp;quot;,rule!RTRR_GRIDComponentNTS(range:local!range,Sheetstart:local!sheetsart,subdstart:local!Subdstart,PTNStart:local!PTNStart,
BLKStart:local!Blkstart,Sheetend:local!sheetend,Subdend:local!Subdend,PTNend:local!PTNend
),{})
          },
          {}
        ),
        if(
          local!showSearchFields = true,
          {},
          {
            with(
              local!businessUnitFilters: rule!GLOB_ArrayFilterGeneration(
                valueArray: local!businessUnitSearchArray_txt,
                operator_txt: &amp;quot;=&amp;quot;,
                field_txt: &amp;quot;BusinessUnit&amp;quot;
              ),
              local!businessUnitLogicalExpression: if(
                rule!APN_isEmpty(
                  local!businessUnitSearchArray_txt
                ),
                null(),
                a!queryLogicalExpression(
                  operator: &amp;quot;OR&amp;quot;,
                  filters: local!businessUnitFilters
                )
              ),
              local!AMUFilters: rule!GLOB_ArrayFilterGeneration(
                valueArray: local!AMUSearchArray_txt,
                operator_txt: &amp;quot;includes&amp;quot;,
                field_txt: &amp;quot;AMU&amp;quot;
              ),
              local!AMULogicalExpression: if(
                rule!APN_isEmpty(
                  local!AMUSearchArray_txt
                ),
                null(),
                a!queryLogicalExpression(
                  operator: &amp;quot;OR&amp;quot;,
                  filters: local!AMUFilters
                )
              ),
              local!provinceFilters: rule!GLOB_ArrayFilterGeneration(
                valueArray: local!provinceSearchArray_txt,
                operator_txt: &amp;quot;=&amp;quot;,
                field_txt: &amp;quot;Province&amp;quot;
              ),
              local!provinceLogicalExpression: if(
                rule!APN_isEmpty(
                  local!provinceSearchArray_txt
                ),
                null(),
                a!queryLogicalExpression(
                  operator: &amp;quot;OR&amp;quot;,
                  filters: local!provinceFilters
                )
              ),
              local!operatingDistrictFilters: rule!GLOB_ArrayFilterGeneration(
                valueArray: local!operatingDistrictSearchArray_txt,
                operator_txt: &amp;quot;includes&amp;quot;,
                field_txt: &amp;quot;District&amp;quot;
              ),
              local!operatingDistrictLogicalExpression: if(
                rule!APN_isEmpty(
                  local!operatingDistrictSearchArray_txt
                ),
                null(),
                a!queryLogicalExpression(
                  operator: &amp;quot;OR&amp;quot;,
                  filters: local!operatingDistrictFilters
                )
              ),
              local!DLSlogicalExpression : rule!RTRR_DLSSearchLogic(ri!RTRR_DLSSearch),
              local!query: rule!GLOB_QueryNestedFilters(
                pagingInfo: local!gridSelection.pagingInfo,
                textParams_txt: {
                  local!UWISearch_txt,
                  local!licenseNoSearch_txt,
                  local!wellNameSearch_txt,
                  local!wellStatusSearch_txt,
                  local!abandonByReasonSearch_txt,
                    {local!Subdstart,
                     if(and(rule!isValueNull(local!sheetend),
               rule!isValueNull(local!PTNend),
               rule!isValueNull(local!Subdend)),local!Subdstart,local!Subdend)
                  }
                  
                },
                queryColumns_txt: {
                    &amp;quot;WellName&amp;quot;,
              &amp;quot;LicensedUWI&amp;quot;,
              &amp;quot;LicenseNo&amp;quot;,
              &amp;quot;DecisionRequiredByDate&amp;quot;,
              &amp;quot;DRBDREASON&amp;quot;,
              &amp;quot;District&amp;quot;,
              &amp;quot;WellBoreID&amp;quot;,
              &amp;quot;AMU&amp;quot;,
              &amp;quot;Province&amp;quot;,
              &amp;quot;LastProductionDate&amp;quot;,
              &amp;quot;BusinessUnit&amp;quot;,
              &amp;quot;SystemDecision&amp;quot;,
              &amp;quot;SystemDecisionDate&amp;quot;,
              &amp;quot;EngineerDecision&amp;quot;,
              &amp;quot;GeologistDecision&amp;quot;,
               &amp;quot;LandmanDecision&amp;quot; ,
               &amp;quot;AbandonByDate&amp;quot;,
               &amp;quot;AbandonByReason&amp;quot;,
                  &amp;quot;IHSStatus&amp;quot;,
                  &amp;quot;WellStatus&amp;quot; ,
                 
                  &amp;quot;RigReleaseDate&amp;quot;,
                  
                  
                },
                textOperations_txt: {
                  &amp;quot;includes&amp;quot;,
                  &amp;quot;includes&amp;quot;,
                  &amp;quot;includes&amp;quot;,
                  &amp;quot;includes&amp;quot;,
                  &amp;quot;=&amp;quot;,
                   {&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;,&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;}
                },
                textColumns_txt: {
                  &amp;quot;LicensedUWI&amp;quot;,
                  &amp;quot;LicenseNo&amp;quot;,
                  &amp;quot;WellName&amp;quot;,
                  &amp;quot;WellStatus&amp;quot;,
                  &amp;quot;AbandonByReason&amp;quot;,
                  {&amp;quot;SUBD&amp;quot;,&amp;quot;SUBD&amp;quot;}
                },
                
               /* integerParams_int:
                {local!TWPStart,local!Twpend,
                local!RangedStart,local!rangeend,
                local!meridianStart,local!meridianend
                },
                
                
               {local!TWPStart,
               if(and(rule!isValueNull(local!Twpend),
               rule!isValueNull(local!rangeend),
               rule!isValueNull(local!meridianend)),local!TWPStart,local!Twpend),
               local!RangedStart,
               if(and(rule!isValueNull(local!Twpend),
               rule!isValueNull(local!rangeend),
               rule!isValueNull(local!meridianend)),local!RangedStart,local!rangeend),
               local!meridianStart,
               if(and(rule!isValueNull(local!Twpend),
               rule!isValueNull(local!rangeend),
               rule!isValueNull(local!meridianend)),local!meridianStart,local!meridianend),
               
               local!sheetsart,
               if(and(rule!isValueNull(local!sheetend),
               rule!isValueNull(local!PTNend),
               rule!isValueNull(local!Subdend)),local!sheetsart,local!sheetend),
               local!PTNStart,
                 if(and(rule!isValueNull(local!sheetend),
               rule!isValueNull(local!PTNend),
               rule!isValueNull(local!Subdend)),local!PTNStart,local!PTNend),
               },
               
                integerOperations_txt:
                {&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;,&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;,&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;,&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;,&amp;quot;&amp;gt;=&amp;quot;,&amp;quot;&amp;lt;=&amp;quot;},
               
                integerColumns_txt:
                {&amp;quot;TWP&amp;quot;,&amp;quot;TWP&amp;quot;,&amp;quot;RGE&amp;quot;,&amp;quot;RGE&amp;quot;,&amp;quot;MER&amp;quot;,&amp;quot;MER&amp;quot;,&amp;quot;SHEET&amp;quot;,&amp;quot;SHEET&amp;quot;,&amp;quot;PTN&amp;quot;,&amp;quot;PTN&amp;quot;},*/
                dateParams_date: append(
                  {},
                  if(
                    local!operatorSearch_txt = &amp;quot;Between&amp;quot;,
                    {
                      local!decisionRequiredByBeginSearch_date,
                      local!decisionRequiredByEndSearch_date
                    },
                    if(
                      local!operatorSearch_txt = &amp;quot;After&amp;quot;,
                      local!decisionRequiredByBeginSearch_date,
                      local!decisionRequiredByEndSearch_date
                    )
                  ),
                  if(
                    local!abandonByDateOperatorSearch_txt = &amp;quot;Between&amp;quot;,
                    {
                      local!abandonByDateBeginSearch_date,
                      local!abandonByDateEndSearch_date
                    },
                    if(
                      local!abandonByDateOperatorSearch_txt = &amp;quot;After&amp;quot;,
                      local!abandonByDateBeginSearch_date,
                      local!abandonByDateEndSearch_date
                    )
                  )
                ),
                dateOperators_txt: append(
                  {},
                  if(
                    local!operatorSearch_txt = &amp;quot;After&amp;quot;,
                    &amp;quot;&amp;gt;&amp;quot;,
                    if(
                      local!operatorSearch_txt = &amp;quot;Before&amp;quot;,
                      &amp;quot;&amp;lt;&amp;quot;,
                      {
                        &amp;quot;&amp;gt;=&amp;quot;,
                        &amp;quot;&amp;lt;=&amp;quot;
                      }
                    )
                  ),
                  if(
                    local!abandonByDateOperatorSearch_txt = &amp;quot;After&amp;quot;,
                    &amp;quot;&amp;gt;&amp;quot;,
                    if(
                      local!abandonByDateOperatorSearch_txt = &amp;quot;Before&amp;quot;,
                      &amp;quot;&amp;lt;&amp;quot;,
                      {
                        &amp;quot;&amp;gt;=&amp;quot;,
                        &amp;quot;&amp;lt;=&amp;quot;
                      }
                    )
                  )
                ),
                dateColumns_txt: {
                  append(
                    {},
                    if(
                      local!operatorSearch_txt = &amp;quot;Between&amp;quot;,
                      {
                        &amp;quot;DecisionRequiredByDate&amp;quot;,
                        &amp;quot;DecisionRequiredByDate&amp;quot;
                      },
                      &amp;quot;DecisionRequiredByDate&amp;quot;
                    ),
                    if(
                      local!abandonByDateOperatorSearch_txt = &amp;quot;Between&amp;quot;,
                      {
                        &amp;quot;AbandonByDate&amp;quot;,
                        &amp;quot;AbandonByDate&amp;quot;
                      },
                      &amp;quot;AbandonByDate&amp;quot;
                    )
                  )
                },
                QueryLogicalExpressions: filter(
                  rule!GLOB_isValueNotNull,
                  append(
                    {},
                    local!businessUnitLogicalExpression,
                    local!AMULogicalExpression,
                    local!provinceLogicalExpression,
                    local!operatingDistrictLogicalExpression,
                    local!DLSlogicalExpression
                   
                  )
                )
              ),
             
              local!IHSWellData: a!queryEntity(
                entity: cons!RTRR_ENTITY_WELLVIEWDATA ,
                query: local!query
              ),
              
              {
                a!sectionLayout(
                  label: &amp;quot;Search Results&amp;quot;&amp;amp;local!query,
                  firstColumnContents: {
                    rule!RTRR_GridDisplayWells(
                      gridSelection: local!gridSelection,
                      selectedWellboreIdList_int: ri!selectedWellboreIdList_int,
                      IHSWellData: local!IHSWellData,
                      selectedWellboreId_int: local!selectedWellboreId_int,
                      SelectedWellList: local!SelectedWellList
                    ),
                    a!buttonLayout(
                      primaryButtons: {
                        a!buttonWidget(
                          label: &amp;quot;Search Again&amp;quot;,
                          value: true,
                          saveInto: {
                            local!showSearchFields &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              true,
                              _
                            ),
                            local!selectedWellboreId_int &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            ri!selectedWellboreIdList_int &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            local!decision_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            local!decisionComments_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            ri!abandonByDate_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            ri!abandonByReasonKey_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            ri!abandonByComment_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              null,
                              _
                            ),
                            local!gridSelection &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              local!defaultGridSelection,
                              _
                            ),
                            local!SelectedWellList &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                              {},
                              _
                            ),
                  local!searchchoice &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!range &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!TWPStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Twpend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!RangedStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!rangeend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!meridianStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!meridianend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Blkstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!sheetsart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!sheetend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!PTNStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!PTNend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Subdstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Subdend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Blkend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  )
                          },
                          submit: false
                        )
                      }
                    )
                  }
                ),
                if(
                  rule!isTextNullOrBlank(
                    local!selectedWellboreId_int
                  ),
                  {},
                  rule!RTRR_SectionDisplayComments(
                    wellboreId_int: local!selectedWellboreId_int
                  )
                ),
                rule!RTRR_SectionGatherDecisionInformation(
                  abandonByDate_date: ri!abandonByDate_date,
                  abandonByReasonKey_txt: ri!abandonByReasonKey_txt,
                  selectedWellboreIdList_int: ri!selectedWellboreIdList_int,
                  abandonByComment_txt: ri!abandonByComment_txt,
                  SelectedWellList: local!SelectedWellList,
                  decision_txt: local!decision_txt,
                  decisionComments_txt: local!decisionComments_txt
                )
              }
            )
          }
        )
      },
      buttons: if(
        local!showSearchFields = false,
        {
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidgetSubmit(
                label: &amp;quot;Submit&amp;quot;,
                style: &amp;quot;PRIMARY&amp;quot;,
                confirmMessage: if(
                  local!decision_txt = &amp;quot;Retain&amp;quot;,
                  cons!RTRR_MESSAGE_CONFIRM_RETAIN,
                  &amp;quot;&amp;quot;
                ),
                value: cons!GLOB_VALUE_BUTTON_SUBMIT,
                saveInto: {
                  ri!buttonAction_txt,
                  ri!Decision.Comments &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    local!decisionComments_txt,
                    _
                  ),
                  ri!Decision.Decision &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    local!decision_txt,
                    _
                  )
                }
              )
            },
            secondaryButtons: {
              a!buttonWidgetSubmit(
                label: &amp;quot;Cancel&amp;quot;,
                style: &amp;quot;DESTRUCTIVE&amp;quot;,
                value: cons!GLOB_VALUE_BUTTON_CANCEL,
                saveInto: ri!buttonAction_txt,
                skipValidation: true
              )
            }
          )
        },
        {
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidget(
                label: &amp;quot;Search&amp;quot;,
                style: &amp;quot;PRIMARY&amp;quot;,
                saveInto: {
                  local!abandonByReasonSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!abandonByReason_txt,
                    _
                  ),
                  local!provinceSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!provinceArray_txt,
                    _
                  ),
                  local!AMUSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!AMUArray_txt,
                    _
                  ),
                  local!licenseNoSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!licenseNo_txt,
                    _
                  ),
                  local!wellStatusSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!wellStatus_txt,
                    _
                  ),
                  local!UWISearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!UWI_txt,
                    _
                  ),
                  local!businessUnitSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!businessUnitArray_txt,
                    _
                  ),
                  local!operatingDistrictSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!operatingDistrictArray_txt,
                    _
                  ),
                  local!decisionRequiredByBeginSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!decisionRequiredByBegin_date,
                    _
                  ),
                  local!decisionRequiredByEndSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!decisionRequiredByEnd_date,
                    _
                  ),
                  local!operatorSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!operator_txt,
                    _
                  ),
                  local!abandonByDateBeginSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!abandonByDateBegin_date,
                    _
                  ),
                  local!abandonByDateEndSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!abandonByDateEnd_date,
                    _
                  ),
                  local!abandonByDateOperatorSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!abandonByDateOperator_txt,
                    _
                  ),
                  local!gridSelection.pagingInfo.startIndex &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    1,
                    _
                  ),
                  local!showSearchFields &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    false,
                    _
                  ),
                  local!wellNameSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!wellName_txt,
                    _
                  ),
                 local!searchchoice &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!searchchoice,
                    _
                  ),
                  a!save(ri!RTRR_DLSSearch.TWPStart ,local!TWPStart),
                  a!save(ri!RTRR_DLSSearch.RGEStart ,local!RangedStart),
                  a!save(ri!RTRR_DLSSearch.MERStart ,local!meridianStart),
                   a!save(ri!RTRR_DLSSearch.TWPEnd,if(and(rule!isValueNull(local!Twpend),
               rule!isValueNull(local!rangeend),
               rule!isValueNull(local!meridianend)),local!TWPStart,local!Twpend)),
               
                a!save(ri!RTRR_DLSSearch.RGEEnd,if(and(rule!isValueNull(local!Twpend),
               rule!isValueNull(local!rangeend),
               rule!isValueNull(local!meridianend)),local!RangedStart,local!rangeend)),
               
                a!save(ri!RTRR_DLSSearch.MEREnd,if(and(rule!isValueNull(local!Twpend),
               rule!isValueNull(local!rangeend),
               rule!isValueNull(local!meridianend)),local!meridianStart,local!meridianend)),
                  /* local!range &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!range,
                    _
                  ),
                  local!TWPStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!TWPStart,
                    _
                  ),
                  local!Twpend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!Twpend,
                    _
                  ),
                  local!RangedStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!RangedStart,
                    _
                  ),
                  local!rangeend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!rangeend,
                    _
                  ),
                  local!meridianStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!meridianStart,
                    _
                  ),
                  local!meridianend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!meridianend,
                    _
                  ),
                  local!Blkstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!Blkstart,
                    _
                  ),
                  local!sheetsart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!sheetsart,
                    _
                  ),
                  local!sheetend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!sheetend,
                    _
                  ),
                  local!PTNStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!PTNStart,
                    _
                  ),
                  local!PTNend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!PTNend,
                    _
                  ),
                  local!Subdstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!Subdstart,
                    _
                  ),
                  local!Subdend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!Subdend,
                    _
                  ),
                  local!Blkend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    ri!Blkend,
                    _
                  )*/
                  
                }
              ),
              a!buttonWidget(
                label: &amp;quot;Clear&amp;quot;,
                saveInto: {
                  local!abandonByReasonSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!abandonByReason_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!provinceSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  ri!provinceArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!AMUSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!provinceTokenArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  ri!AMUArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!licenseNoSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!licenseNo_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!wellStatus_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!wellStatusSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!UWISearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    &amp;quot;&amp;quot;,
                    _
                  ),
                  ri!UWI_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    &amp;quot;&amp;quot;,
                    _
                  ),
                  local!businessUnitSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  ri!businessUnitArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!businessUnitTokenArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!operatingDistrictSearchArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  ri!operatingDistrictArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!operatingDistrictTokenArray_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    {},
                    _
                  ),
                  local!decisionRequiredByBeginSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!decisionRequiredByBegin_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!decisionRequiredByEndSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!decisionRequiredByEnd_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!operatorSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!abandonByDateBeginSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!abandonByDateBegin_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!abandonByDateEndSearch_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!abandonByDateEnd_date &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!abandonByDateOperator_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!abandonByDateOperatorSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!operator_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!gridSelection.pagingInfo.startIndex &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    1,
                    _
                  ),
                  local!wellNameSearch_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!wellName_txt &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  
                  local!range &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!TWPStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Twpend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!RangedStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!rangeend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!meridianStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!meridianend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Blkstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!sheetsart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!sheetend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!PTNStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!PTNend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Subdstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Subdend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  local!Blkend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!searchchoice &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!range &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!TWPStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!Twpend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!RangedStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!rangeend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!meridianStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!meridianend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!Blkstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!sheetsart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!sheetend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!PTNStart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!PTNend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!Subdstart &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!Subdend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  ),
                  ri!Blkend &amp;lt;&amp;lt; rule!APN_returnFirstInput(
                    null,
                    _
                  )
                }
              )
            },
            secondaryButtons: {
              a!buttonWidgetSubmit(
                label: &amp;quot;Cancel&amp;quot;,
                style: &amp;quot;DESTRUCTIVE&amp;quot;,
                value: cons!GLOB_VALUE_BUTTON_CANCEL,
                saveInto: ri!buttonAction_txt,
                skipValidation: true
              )
            }
          )
        }
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am getting the following error&lt;/p&gt;
&lt;p&gt;Expression evaluation error in rule &amp;#39;rtrr_formmultiplewelldecision&amp;#39; at function a!queryEntity [line 521]: Cannot apply operator [EQUALS] to field [TWP] when comparing to value [TypedValue[it=101,v={104}]].&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52343?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2018 04:43:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f7a9860d-6bc8-4286-92e3-eeef1f399b90</guid><dc:creator>Soujanya B</dc:creator><description>I am in to 16.3 version of Appian , I don&amp;#39;t think we have foreach in 16.3.&lt;br /&gt;
I don&amp;#39;t have CDT to save those values , let me create and save those values to it.&lt;br /&gt;
I can use apply () to achieve right.&lt;br /&gt;
I will check and let me know if I face any issue.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52330?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2018 18:51:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:491af873-d851-4159-baff-bc4fa2a3362f</guid><dc:creator>Ram</dc:creator><description>&lt;p&gt;Hi Soujanya,&lt;br /&gt; &lt;br /&gt; Can you try to create a logical expression in the below format and try to use the same in your code after necessary modifications.&lt;br /&gt; &lt;br /&gt; logicalExpression: a!queryLogicalExpression(&lt;br /&gt; operator: &amp;quot;OR&amp;quot;,&lt;br /&gt; logicalExpressions: {&lt;br /&gt; a!forEach(&lt;br /&gt; items: ri!yourInputCDT,&lt;br /&gt; /* Create a display cdt with the fromTWP, toTWP, fromRGE, toRGE, fromMER, toMER values or if they alredy exist in a cdt use that cdt*/&lt;br /&gt; expression: /* Have the below code in an expression rule so that you can use it here*/&lt;br /&gt; a!queryLogicalExpression(&lt;br /&gt; operator: &amp;quot;AND&amp;quot;,&lt;br /&gt; filters: if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; ri!yourInputCDT&lt;br /&gt; ),&lt;br /&gt; /*have a default filter here*/&amp;quot;&amp;quot;,&lt;br /&gt; {&lt;br /&gt; if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;fromTWP&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;&amp;quot;,&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;TWP&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;br /&gt; value: index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;fromTWP&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;toTWP&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;&amp;quot;,&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;TWP&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;lt;=&amp;quot;,&lt;br /&gt; value: index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;toTWP&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;fromRGE&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;&amp;quot;,&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;RGE&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;br /&gt; value: index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;fromRGE&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;toRGE&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;&amp;quot;,&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;RGE&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;lt;=&amp;quot;,&lt;br /&gt; value: index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;toRGE&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;fromMER&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;&amp;quot;,&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;MER&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;gt;=&amp;quot;,&lt;br /&gt; value: index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;fromMER&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; if(&lt;br /&gt; rule!APN_isEmpty(&lt;br /&gt; index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;toMER&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; ),&lt;br /&gt; &amp;quot;&amp;quot;,&lt;br /&gt; a!queryFilter(&lt;br /&gt; field: &amp;quot;MER&amp;quot;,&lt;br /&gt; operator: &amp;quot;&amp;lt;=&amp;quot;,&lt;br /&gt; value: index(&lt;br /&gt; ri!yourInputCDT,&lt;br /&gt; &amp;quot;toMER&amp;quot;,&lt;br /&gt; {}&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; }&lt;br /&gt; )&lt;br /&gt; &lt;br /&gt; Let me know if have any doubts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52321?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2018 17:20:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:abf954b3-4c40-4b61-82e1-3464cb53d0f2</guid><dc:creator>Soujanya B</dc:creator><description>Can anyone suggest on this pls&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52299?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2018 08:32:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9742c0d7-c65e-412b-b7f2-0489667835f2</guid><dc:creator>Soujanya B</dc:creator><description>Yes , I have to amend in the existing code along wth the other search fields.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: query needs to be dynamically created based on the search fields using a!queryentity ?</title><link>https://community.appian.com/thread/52278?ContentTypeID=1</link><pubDate>Mon, 05 Feb 2018 16:50:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8e576600-d998-48c4-878c-601aa3327c0f</guid><dc:creator>Justin Watts</dc:creator><description>I recommend looking into a!logicalExpression which gives you the options to OR groups of a!queryFilters or other a!logicalExpressions(), which should give you want you want if I&amp;#39;m understanding your question correctly. &lt;a href="https://docs.appian.com/suite/help/17.4/fnc_system_a_querylogicalexpression.html"&gt;docs.appian.com/.../fnc_system_a_querylogicalexpression.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
For your example, you would create 3 logical expressions for &amp;quot;(TWP =104 and RGE &amp;gt;=1 and MER &amp;gt;=5)&amp;quot;, &amp;quot;(TWP &amp;gt;= 104 and TWP &amp;lt;= 106)&amp;quot;, and &amp;quot;(TWP =106 and RGE &amp;lt;=23 and MER &amp;lt;=6)&amp;quot; and wrap all three with a parent logical expression with the operator attribute set to &amp;quot;OR&amp;quot;. Then pass this logical expression into your queryEntity&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>