<?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>Expression rule</title><link>https://community.appian.com/discussions/f/new-to-appian/22957/expression-rule</link><description>Hi guys, 
 I am new to appian, anyone explain this code line by line briefly. 
 if(rule!AF_RULE_General_isBlank(wherecontains(cons!GCC_DSE_cons_getReadOnlyDrillStatus, tointeger(local!drill.drillStatus))), 
 remove(local! facilityFloors, wherecontains</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/89024?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 16:44:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13f4a3e3-950d-4fea-aca4-d926d43fce5d</guid><dc:creator>vamsikrishnac471879</dc:creator><description>&lt;p&gt;Sorry about that and thank you for ur time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/89023?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 16:44:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9f98df27-3be8-46b3-b508-559fd3eaed61</guid><dc:creator>vamsikrishnac471879</dc:creator><description>&lt;p&gt;Thank you very much Hrishikesh Dixit &amp;nbsp;for ur time and the answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/89020?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 16:00:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:197ab29d-e1f9-4737-a5b6-84cdf05b7686</guid><dc:creator>hrishikeshd997</dc:creator><description>&lt;p&gt;I think spacing is an issue here.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I reformatted the code as follows and added some notes.&lt;/p&gt;
&lt;p&gt;Basically it&amp;#39;s using a combination of wherecontains which&amp;nbsp;&lt;span&gt;Receives one or more values and returns an array of indices that indicate the position of the values within the array&lt;/span&gt; and removes those values&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/21.4/fnc_array_wherecontains.html"&gt;https://docs.appian.com/suite/help/21.4/fnc_array_wherecontains.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/21.4/fnc_array_remove.html"&gt;https://docs.appian.com/suite/help/21.4/fnc_array_remove.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  /* Checks if local!drillStatus has any values listed from the cons!GCC_DSE_cons_getReadOnlyDrillStatus*/
  rule!AF_RULE_General_isBlank(
    wherecontains(
      cons!GCC_DSE_cons_getReadOnlyDrillStatus,
      tointeger(local!drill.drillStatus)
    )
  ),
  /* If yes (from line 2) then, finds all indexes of items which have local!facilityFloor.isActive = false()
  and removes them from local!facilityFloors*/
  remove(
    local!facilityFloors,
    wherecontains(false, local!facilityFloors.isActive)
  ),
  /* If no (from line 2)*/
  if(    
    not(
      rule!AF_RULE_General_isBlank(local!drillfacilityFloors)
    ),
    /* If local!drillFacilityFloors has any value (not empty), retrun it */
    local!drillfacilityFloors,
    /* Else, finds all indexes of items which have local!facilityFloor.isActive = false()
    and removes them from local!facilityFloors */
    remove(
      local!facilityFloors,
      wherecontains(false, local!facilityFloors.isActive)
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/89017?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 15:50:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ff038cfa-6229-4780-a46a-0ebe60a6f900</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Same code, same syntax error&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span&gt;Expression evaluation error: Syntax error. Details: Cannot create an identifier with zero length key&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;...that is, this code will never work as it stands.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/89016?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 15:42:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a9c7aa64-7a04-42c7-87bf-eae4e8a6f151</guid><dc:creator>vamsikrishnac471879</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(rule!AF_RULE_General_isBlank(wherecontains(cons!GCC_DSE_cons_getReadOnlyDrillStatus,tointeger(local!drill.drillStatus))),
remove(local! facilityFloors, wherecontains (false,local! facilityFloors.isActive)),
if(not(rule!AF_RULE_General_isBlank(local!drillfacilityFloors)),
local! drillfacilityFloors,
remove(local!facilityFloors, wherecontains (false,local!facilityFloors.isActive))))&lt;/pre&gt;now see the code i have inserted&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression rule</title><link>https://community.appian.com/thread/89010?ContentTypeID=1</link><pubDate>Mon, 13 Dec 2021 14:24:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d7930bfd-4a84-4dcb-9307-d56f177cb7b7</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Vamsi&lt;/p&gt;
&lt;p&gt;Firstly, for future reference, please use the &amp;quot;Insert Code&amp;quot; option to include code in your posts as it makes it way easier to read/copy/paste for those of us who are trying to help:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1639405079507v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Secondly:&amp;nbsp;the code doesn&amp;#39;t look well-formed to me. Pasting it into the Expression Editor it throws a syntax error:&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/62/pastedimage1639405387496v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>