<?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>How is this possible?</title><link>https://community.appian.com/discussions/f/general/30941/how-is-this-possible</link><description>Let me share with you the results of this code snippet 
 a!map( length: length(local!taller.resultado.contractSetting.annuitySettings.paymentMethods), pm: local!taller.resultado.contractSetting.annuitySettings.paymentMethods, isnull: a!isNullOrEmpty(local</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How is this possible?</title><link>https://community.appian.com/thread/123244?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 16:10:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f5a9a0bf-17ac-4590-b77b-fd751730e3a3</guid><dc:creator>juergeng0002</dc:creator><description>&lt;p&gt;Or you might utilize Stefan&amp;#39;s rule &amp;#39;isVoid&amp;#39; checking for empty structures (all sorts of). ri!value is of type &amp;#39;Any Type&amp;#39;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  a!isNullOrEmpty(ri!value),
  true,
  a!localVariables(
    local!typeNum: a!refreshVariable(
      value: runtimetypeof(ri!value),
      refreshAlways: true
    ),

    /* Strings */
    if(
      local!typeNum = &amp;#39;type!{http://www.appian.com/ae/types/2009}Text&amp;#39;,
      /* Ignore white space */
      len(trim(ri!value)) = 0,

      /* List of Variant */
      if(
        local!typeNum = &amp;#39;type!{http://www.appian.com/ae/types/2009}Variant?list&amp;#39;,
        all(a!isNullOrEmpty(_), a!flatten(ri!value)),

        /* Lists */
        if(
          /* Try to take first item in list and cast it to a list of itself */
          /* then compare its datatype to the incoming data type */
          local!typeNum = runtimetypeof(cast(runtimetypeof({index(ri!value, 1, null)}), ri!value)),

          /* Flatten takes care of lists in lists in lists in ... */
          /* List has zero non-null items, length() already ignores null values*/
          length(a!flatten(ri!value)) = 0,

          /* Map */
          if(
            local!typeNum = &amp;#39;type!{http://www.appian.com/ae/types/2009}Map&amp;#39;,
            /* Has no keys at all or all values are null */
            or(
              length(a!keys(ri!value)) = 0,
              all(a!isNullOrEmpty(_), index(ri!value, a!keys(ri!value), null))
            ),

            /* DataSubsets or Maps returned by queryRecordType */
            if(
              or(
                local!typeNum = &amp;#39;type!{http://www.appian.com/ae/types/2009}DataSubset&amp;#39;,
                and(
                  local!typeNum = &amp;#39;type!{http://www.appian.com/ae/types/2009}Map&amp;#39;,
                  contains(a!keys(ri!value), &amp;quot;data&amp;quot;),
                )
              ),
              a!isNullOrEmpty(ri!value.data),

              /* No idea what this could be so it is considered to not be null */
              false
            )
          )
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is this possible?</title><link>https://community.appian.com/thread/123242?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 15:30:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:011ee053-17c7-40da-ac59-4d1801f1749c</guid><dc:creator>Luis Ripoll Morales</dc:creator><description>&lt;p&gt;Thank you Stefan, it works.&lt;/p&gt;
&lt;p&gt;I had solved the error with this&lt;/p&gt;
&lt;p&gt;and(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length(local!taller.resultado.contractSetting.annuitySettings.paymentMethods) = 1,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a!isNotNullOrEmpty(local!taller.resultado.contractSetting.annuitySettings.paymentMethods)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ),&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Both solution are quite ugly&amp;nbsp;&lt;span class="emoticon" data-url="https://community.appian.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I think that Appian engineers should work on this, it is not coherent that length funntion returns 1 on an empty array&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is this possible?</title><link>https://community.appian.com/thread/123241?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 15:13:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:998522e2-37fa-4fd6-bad0-1a22ef11cd12</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;The problem here is the edge cases around empty lists and variants. The following snippet replicates that.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;length(cast(type!Variant, {}))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Try to cast that empty list of dictionaries into a list of Maps. Not great, but works for me.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;length(cast(a!listType(type!Map), local!data.annuitySettings.paymentMethods))&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is this possible?</title><link>https://community.appian.com/thread/123239?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 14:59:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30cd5fc1-512e-4d7f-92c8-d4b83cd63091</guid><dc:creator>Luis Ripoll Morales</dc:creator><description>&lt;p&gt;Here you have direct output from the service which this data come from, in json format&lt;/p&gt;
&lt;p&gt;&amp;quot;annuitySettings&amp;quot;:{&amp;quot;paymentMethodTypeCode&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;paymentMethodTypeDesc&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;paymentMethods&amp;quot;:[]},&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is this possible?</title><link>https://community.appian.com/thread/123238?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 14:55:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b4581f15-e12e-42af-b65c-49439740c0c0</guid><dc:creator>Luis Ripoll Morales</dc:creator><description>&lt;p&gt;It looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/11/pastedimage1702911283254v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How is this possible?</title><link>https://community.appian.com/thread/123237?ContentTypeID=1</link><pubDate>Mon, 18 Dec 2023 14:52:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:56fe0a3b-24fc-414b-9911-b5b1f8322a7b</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Impossible to say without knowing &lt;strong&gt;exactly&lt;/strong&gt; what this data structure looks like.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>