<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Arcade Attribute Calc Rule Function &amp;quot;Contains&amp;quot; fails on Server in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26102#M2</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/179339" target="_blank"&gt;Nico Luus&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a good thing that you checked the version matrix and you are right, the Contains function was introduced at Arcade version 1.7 which corresponds to Enterprise 10.7.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I would first start with validating if the first line is correct for accessing the points. Are they in the same $datastore as the current feature, is the name correct, etc? Did you use the interface to construct the Arcade expression or did you manually type in the name of the featurelayer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also try to use the Intersects function instead of the Contains function and see if the result is different:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; GeopointFS &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$datastore&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"STAGING.LDR.Geo_Frame"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fsint &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;GeopointFS&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsint&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Notice that I am not returning null. If it does not find any points in the polygon it&amp;nbsp;would be logical to state that there are 0 points, but maybe your requirements are different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some other considerations:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Do you have rules in place in case the points change?&lt;/LI&gt;&lt;LI&gt;Do you also trigger the update of the polygons to recalculate the number of points?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:03:29 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-10T21:03:29Z</dc:date>
    <item>
      <title>Arcade Attribute Calc Rule Function "Contains" fails on Server</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26101#M1</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day all.&lt;/P&gt;&lt;P&gt;I think I might have encountered a bug but before reporting it as such I would like to ask if somebody else can replicate this issue.&lt;/P&gt;&lt;P&gt;Context: I have a polygon FC which should count how many points it encloses and return the number upon creation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Software Version: ArcGIS Pro (2.5.1), ArcGIS Server (10.71)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arcade Script of Polygon FC:&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var GeopointFS = FeatureSetByName($datastore, "STAGING.LDR.Geo_Frame");&lt;BR /&gt;var ContaindPts = Contains($feature, GeopointFS)&lt;BR /&gt;if (ContaindPts &amp;lt; 1) {return null}&lt;BR /&gt;if (IsEmpty(ContaindPts)) { return null}&lt;BR /&gt;var CntGP = Count(ContaindPts);&lt;BR /&gt;return CntGP&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This script works perfectly fine when running on FC level, however when publishing and running it using the service I receive the following error on line 2:&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Arcade Error: Geometry type or nulle expected.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;IMG __jive_id="508746" alt="On the left, I attempt to add a polygon in ArcGIS Pro using the Feature Service. " class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/508746_2020-09-28_16-30-20.jpg" /&gt;&lt;/P&gt;&lt;P&gt;On the left I attempt to add a polygon using the Feature Service, on the right using the Feature Class.&amp;nbsp; The latter works as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the ArcGIS Arcade version matrix found &lt;A href="https://developers.arcgis.com/arcade/guide/version-matrix/"&gt;here&lt;/A&gt;, it is indicated that the "Contains" &lt;A href="https://developers.arcgis.com/arcade/function-reference/geometry_functions/#contains"&gt;function&lt;/A&gt;, which is supported from Arcade verson 1.7 onwards should work on ArcGIS Enterprise server 10.7.1.&lt;/P&gt;&lt;P&gt;Anybody else encountered this yet?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your considerations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nico&lt;/P&gt;&lt;P&gt;arcade geometry,&amp;nbsp;contains(),&amp;nbsp;attribute-rules,&amp;nbsp;attribute calculation error,&amp;nbsp;arcade 1.7‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:44:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26101#M1</guid>
      <dc:creator>NicoLuus</dc:creator>
      <dc:date>2020-09-28T14:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Attribute Calc Rule Function "Contains" fails on Server</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26102#M2</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/179339" target="_blank"&gt;Nico Luus&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a good thing that you checked the version matrix and you are right, the Contains function was introduced at Arcade version 1.7 which corresponds to Enterprise 10.7.1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I would first start with validating if the first line is correct for accessing the points. Are they in the same $datastore as the current feature, is the name correct, etc? Did you use the interface to construct the Arcade expression or did you manually type in the name of the featurelayer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also try to use the Intersects function instead of the Contains function and see if the result is different:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; GeopointFS &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$datastore&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"STAGING.LDR.Geo_Frame"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fsint &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;GeopointFS&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fsint&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Notice that I am not returning null. If it does not find any points in the polygon it&amp;nbsp;would be logical to state that there are 0 points, but maybe your requirements are different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some other considerations:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Do you have rules in place in case the points change?&lt;/LI&gt;&lt;LI&gt;Do you also trigger the update of the polygons to recalculate the number of points?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26102#M2</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-10T21:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Attribute Calc Rule Function "Contains" fails on Server</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26103#M3</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I can confirm that the "Geo_Frame" point FC is indeed in the same $datastore as the "Sections" polygon FC (The one the rule is built on) and I used the interface to add these.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code itself should not be a problem since it functions as expected when I capture polygons using the FC.&amp;nbsp; The error message is encountered as soon as I publish it as a Feature Service (FS) and then try and capture a "Sections" polygon using this FS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used "Intersects" instead of the "Contains" function, as you proposed, and it works!:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Comparison of capturing data using FC &amp;amp; FS and the Arcade Attribute Calc rule using the Intersects function." class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/508918_2020-09-30_09-55-53.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using "Intersects" rather than "Contains" will satisfy my requirement but I am quite confident that there is a bug with the "Contains" function after my test results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the next step in reporting it?&lt;/P&gt;&lt;P&gt;Could anybody else replicate the error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:10:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26103#M3</guid>
      <dc:creator>NicoLuus</dc:creator>
      <dc:date>2020-09-30T08:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Attribute Calc Rule Function "Contains" fails on Server</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26104#M4</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/179339"&gt;Nico Luus&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you mentioned, there might be an issue with the Contains function (at least it seams that way). I would recommend you to contact Esri Support and work with them to report the issue.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2020 14:17:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/arcade-attribute-calc-rule-function-quot-contains/m-p/26104#M4</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-09-30T14:17:16Z</dc:date>
    </item>
  </channel>
</rss>

