<?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>Appian expression rule strange behaviour</title><link>https://community.appian.com/discussions/f/general/39749/appian-expression-rule-strange-behaviour</link><description>Hello, Consider the following test code: 
 Here test_1 has value : false and test_0 has value true. What is the cause of this? Please find the screenshot as follows:</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151687?ContentTypeID=1</link><pubDate>Mon, 22 Sep 2025 15:41:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:10d2fb7d-2d8a-4cd3-a00d-f4ba537fa50d</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Sadly OP has seemingly no-showed this thread - I was greedily hoping for some validation on my correct answer from nearly 3 days ago &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f601.svg" title="Grin"&gt;&amp;#x1f601;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Funny, I never exactly realized that the casting works out that way for all strings beginning with &amp;quot;T&amp;quot; and &amp;quot;Y&amp;quot; as well.&amp;nbsp; It makes sense in a way of course, though in situations like the original post here, when someone wanders into a &amp;quot;typecast as boolean&amp;quot; situation with no idea what&amp;#39;s happening or why, it can produce some truly silly results &lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f61b.svg" title="Stuck out tongue"&gt;&amp;#x1f61b;&lt;/span&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1758555699889v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151682?ContentTypeID=1</link><pubDate>Mon, 22 Sep 2025 07:09:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:917479fd-b009-454e-b1cb-324b3f776846</guid><dc:creator>amerayanaa709622</dc:creator><description>&lt;h2 id="mcetoc_1j5o42kug0" data-start="2864" data-end="2910"&gt;&lt;span style="font-size:75%;"&gt;I was trying to understand the issue using gpt ,in one of it&amp;#39;s responses :&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;.... How to fix it:&lt;/h2&gt;
&lt;p data-start="2912" data-end="2996"&gt;If the goal is &amp;ldquo;non-zero value&amp;rdquo; plus the &lt;code data-start="2953" data-end="2969"&gt;Torerance_Name&lt;/code&gt; being &amp;ldquo;Mean&amp;rdquo;, they should:&lt;/p&gt;
&lt;ul data-start="2998" data-end="3183"&gt;
&lt;li data-start="2998" data-end="3052"&gt;
&lt;p data-start="3000" data-end="3052"&gt;Use numeric types, not strings, when testing numbers&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="3053" data-end="3183"&gt;
&lt;p data-start="3055" data-end="3183"&gt;Or compare the string explicitly, e.g. check if the string is not &lt;code data-start="3121" data-end="3126"&gt;&amp;quot;0&amp;quot;&lt;/code&gt; or not empty or convert it to number and see if it&amp;#39;s &amp;gt; 0&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="3185" data-end="3204"&gt;Some example fixes:&lt;/p&gt;
&lt;div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary"&gt;
&lt;div class="sticky top-9"&gt;
&lt;div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"&gt;
&lt;div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="overflow-y-auto p-4" dir="ltr"&gt;&lt;code class="whitespace-pre! language-apian"&gt;&lt;span&gt;a!localVariables(
  local!Torerance_Name: &amp;quot;Mean&amp;quot;,
  local!value: 15.0,  /* numeric, not string */
  local!test_correct: and(
    local!Torerance_Name = &amp;quot;Mean&amp;quot;,
    local!value &amp;gt; 0
  )
)
&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p data-start="3406" data-end="3459"&gt;Or if the value is coming in as a string, convert it:&lt;/p&gt;
&lt;div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary"&gt;
&lt;div class="sticky top-9"&gt;
&lt;div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"&gt;
&lt;div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="overflow-y-auto p-4" dir="ltr"&gt;&lt;code class="whitespace-pre! language-apian"&gt;&lt;span&gt;a!localVariables(
  local!Torerance_Name: &amp;quot;Mean&amp;quot;,
  local!valueString: &amp;quot;8.2&amp;quot;,
  local!value: todecimal(local!valueString, 0),   /* or appropriate function to convert or parse */
  local!test_correct: and(
    local!Torerance_Name = &amp;quot;Mean&amp;quot;,
    local!value &amp;gt; 0
  )
)
&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p data-start="3741" data-end="3826"&gt;Or if the string is just being tested for being non-empty or non-zero in string form:&lt;/p&gt;
&lt;div class="contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary"&gt;
&lt;div class="sticky top-9"&gt;
&lt;div class="absolute end-0 bottom-0 flex h-9 items-center pe-2"&gt;
&lt;div class="bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="overflow-y-auto p-4" dir="ltr"&gt;&lt;code class="whitespace-pre! language-apian"&gt;&lt;span&gt;a!localVariables(
  local!Torerance_Name: &amp;quot;Mean&amp;quot;,
  local!valueStrinacg: &amp;quot;8.2&amp;quot;,
  local!test_correct: and(
    local!Torerance_Name = &amp;quot;Mean&amp;quot;,
    local!valueString &amp;lt;&amp;gt; &amp;quot;&amp;quot; ,
    local!valueString &amp;lt;&amp;gt; &amp;quot;0&amp;quot;
  )
)&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="WidgetFloaterPanels" class="LTRStyle" style="direction:ltr;display:none;text-align:left;"&gt;
&lt;div id="WidgetFloater" style="display:none;"&gt;
&lt;div id="WidgetLogoPanel"&gt;&lt;span id="WidgetTranslateWithSpan"&gt;&lt;span&gt;TRANSLATE with &lt;/span&gt;&lt;/span&gt; &lt;span id="WidgetCloseButton" title="Exit Translation"&gt;x&lt;/span&gt;&lt;/div&gt;
&lt;div id="LanguageMenuPanel"&gt;
&lt;div class="DDStyle_outer"&gt;&lt;span id="__LanguageMenu_header" class="DDStyle"&gt;English&lt;/span&gt;
&lt;div style="left:0;position:relative;text-align:left;"&gt;
&lt;div style="position:absolute;"&gt;
&lt;div id="__LanguageMenu_popup" class="DDStyle" style="display:none;"&gt;
&lt;table id="LanguageMenu" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#ar"&gt;Arabic&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#he"&gt;Hebrew&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#pl"&gt;Polish&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#bg"&gt;Bulgarian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#hi"&gt;Hindi&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#pt"&gt;Portuguese&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#ca"&gt;Catalan&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#mww"&gt;Hmong Daw&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#ro"&gt;Romanian&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#zh-CHS"&gt;Chinese Simplified&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#hu"&gt;Hungarian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#ru"&gt;Russian&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#zh-CHT"&gt;Chinese Traditional&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#id"&gt;Indonesian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#sk"&gt;Slovak&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#cs"&gt;Czech&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#it"&gt;Italian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#sl"&gt;Slovenian&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#da"&gt;Danish&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#ja"&gt;Japanese&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#es"&gt;Spanish&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#nl"&gt;Dutch&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#tlh"&gt;Klingon&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#sv"&gt;Swedish&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#en"&gt;English&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#ko"&gt;Korean&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#th"&gt;Thai&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#et"&gt;Estonian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#lv"&gt;Latvian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#tr"&gt;Turkish&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#fi"&gt;Finnish&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#lt"&gt;Lithuanian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#uk"&gt;Ukrainian&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#fr"&gt;French&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#ms"&gt;Malay&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#ur"&gt;Urdu&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#de"&gt;German&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#mt"&gt;Maltese&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#vi"&gt;Vietnamese&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#el"&gt;Greek&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#no"&gt;Norwegian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#cy"&gt;Welsh&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="#ht"&gt;Haitian Creole&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="#fa"&gt;Persian&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="CTFLinksPanel"&gt;&lt;span id="ExternalLinksPanel"&gt;&lt;a id="HelpLink" title="Help" href="https://go.microsoft.com/?linkid=9722454" rel="noopener noreferrer" target="_blank"&gt; &lt;/a&gt; &lt;a id="EmbedLink" title="Get this widget for your own site"&gt;&lt;/a&gt;  &lt;a id="ShareLink" title="Share translated page with friends"&gt;&lt;/a&gt;  &lt;/span&gt;&lt;/div&gt;
&lt;div id="FloaterProgressBar"&gt;&lt;span id="ProgressFill"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="WidgetFloaterCollapsed" style="display:none;"&gt;&lt;span&gt;TRANSLATE with &lt;/span&gt;&lt;/div&gt;
&lt;div id="FloaterSharePanel" style="display:none;"&gt;
&lt;div id="ShareTextDiv"&gt;&lt;span id="ShareTextSpan"&gt; COPY THE URL BELOW &lt;/span&gt;&lt;/div&gt;
&lt;div id="ShareTextboxDiv"&gt;&lt;!--a id="TwitterLink" title="Share on Twitter"&gt; &lt;img id="TwitterImg" /&gt;&lt;/a&gt; &lt;a--&gt;  &lt;a id="EmailLink" title="Email this translation"&gt;&lt;/a&gt; &lt;/div&gt;
&lt;div id="ShareFooter"&gt;&lt;span id="ShareHelpSpan"&gt;&lt;a id="ShareHelpLink"&gt;&lt;/a&gt; &lt;/span&gt; &lt;span id="ShareBackSpan"&gt;&lt;a id="ShareBack" title="Back To Translation"&gt;&lt;/a&gt; Back&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id="FloaterEmbed" style="display:none;"&gt;
&lt;div id="EmbedTextDiv"&gt;&lt;span id="EmbedTextSpan"&gt;EMBED THE SNIPPET BELOW IN YOUR SITE&lt;/span&gt; &lt;a id="EmbedHelpLink" title="Copy this code and place it into your HTML."&gt;&lt;/a&gt; &lt;/div&gt;
&lt;div id="EmbedTextboxDiv"&gt;&lt;/div&gt;
&lt;div id="EmbedNoticeDiv"&gt;&lt;span id="EmbedNoticeSpan"&gt;Enable collaborative features and customize widget: &lt;a href="http://www.bing.com/widget/translator" rel="noopener noreferrer" target="_blank"&gt;Bing Webmaster Portal&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div id="EmbedFooterDiv"&gt;&lt;span id="EmbedBackSpan"&gt;Back&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151675?ContentTypeID=1</link><pubDate>Sun, 21 Sep 2025 06:29:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ca86835-1a6b-4254-b80d-76f1333795fd</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Appian casts strings to boolean and In Expression Strings beginning with &amp;quot;t&amp;quot;, &amp;quot;T&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;Y&amp;quot;, or &amp;quot;1&amp;quot; return true; all other strings return false.&lt;br /&gt;Remove the string values from and() or use explicit boolean comparisons.&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1758436053743v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151672?ContentTypeID=1</link><pubDate>Sat, 20 Sep 2025 21:36:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5e1a11ad-8bd7-4363-aaa7-df6dde9b88ce</guid><dc:creator>David Jimenez </dc:creator><description>&lt;p&gt;The problem is the one pointed out by Stefan&amp;hellip; the and function is not correctly coded&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151660?ContentTypeID=1</link><pubDate>Fri, 19 Sep 2025 15:42:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:386bc53a-dddf-4277-88c0-203c038d2f04</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;The and() function expects a list of boolean arguments.&amp;nbsp; Neither the text value &amp;quot;15.0&amp;quot; or &amp;quot;8.2&amp;quot; are boolean values.&amp;nbsp; My guess is that when the and() function is typecasting both of these to boolean, it gets as far as seeing that &amp;quot;15.0&amp;quot; starts with &amp;quot;1&amp;quot;, which aliases to a value of &amp;quot;TRUE&amp;quot; in most contexts, and thus casts it as &amp;quot;TRUE&amp;quot;; and likewise when it sees that &amp;quot;8.2&amp;quot; does not start with &amp;quot;1&amp;quot;, it gets cast as &amp;quot;FALSE&amp;quot;.&lt;/p&gt;
&lt;p&gt;Any chance you tested this out?&lt;br /&gt;&lt;img style="max-height:182px;max-width:307px;" height="182" src="/resized-image/__size/614x364/__key/communityserver-discussions-components-files/11/pastedimage1758296360839v1.png" width="307" alt=" " /&gt;&lt;img style="max-height:193px;max-width:281px;" height="193" src="/resized-image/__size/562x386/__key/communityserver-discussions-components-files/11/pastedimage1758296388604v2.png" width="281" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;So to answer your first question: no, it&amp;#39;s not an Appian bug.&lt;/p&gt;
&lt;p&gt;To echo Stefan as usual, what are you trying to achieve when you put the &amp;quot;15.0&amp;quot; and &amp;quot;8.2&amp;quot; text values in this rule?&amp;nbsp; If I could tell what your intended rationality was I&amp;#39;d love to help you come up with the appropriate expression, but I&amp;#39;m struggling to understand.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151657?ContentTypeID=1</link><pubDate>Fri, 19 Sep 2025 14:54:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:acacc14e-b198-4b23-8e79-7a2d243f260c</guid><dc:creator>Sowvik Roy</dc:creator><description>&lt;p&gt;Trying to achieve a simple logic, if there is a non zero value and&amp;nbsp;local!Torerance_Name is mean &amp;quot;Mean&amp;quot; then some logic.&lt;br /&gt;The output must be uniform, I can&amp;#39;t find any logic behind this different output. Is it an Appian bug?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Appian expression rule strange behaviour</title><link>https://community.appian.com/thread/151656?ContentTypeID=1</link><pubDate>Fri, 19 Sep 2025 14:47:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:60c5f50d-fe80-458a-9018-c5fa102e842a</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Not sure what you think this &amp;quot;and()&amp;quot; is doing.&lt;/p&gt;
&lt;p&gt;What do you try to achieve?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>