<?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 Can Not Get Calculated Expressions to Work in Forms in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510008#M60486</link>
    <description>&lt;P&gt;I was hoping someone could help me figure out the issue I am having with configuring forms in New Webmap Viewer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to configure my form to automatically fill in a field from an intersecting layer using the code from this&amp;nbsp;&lt;A href="https://doc.arcgis.com/en/arcgis-online/create-maps/create-form-mv.htm" target="_blank" rel="noopener"&gt;article on configuring forms for attribute editing.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The layer I am trying to intersect from is named 'Pole_feat' and I am trying to auto-populate my form to pull the value from the field 'wmextPole_TRMB_COMMENT'. This will save our field workers a tremendous amount of time as this value can get quite long.&lt;/P&gt;&lt;P&gt;When I test my code, &lt;STRONG&gt;it seems to work&lt;/STRONG&gt; just fine and return the value I want (please see Image 1). However, when I test it out in field maps, it will only return my else statement of "nothing" (not all poles have this value filled out, so wanted an else statement).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following:&lt;/P&gt;&lt;P&gt;-Verified both are in the same spatial reference&lt;/P&gt;&lt;P&gt;-Turned on snapping of my form's inspection feature&lt;/P&gt;&lt;P&gt;-Removed the else statement&lt;/P&gt;&lt;P&gt;-Verified the coordinates overlap (see Image 2)&lt;/P&gt;&lt;P&gt;-Tried turning on Pole_feat's popups&lt;/P&gt;&lt;P&gt;-Gave the wmextPoleT_TRMB_COMMENT an alias and tried using that&lt;/P&gt;&lt;P&gt;-Verified that the wmextPole_TRMB_COMMENT field has data (again please see Image 2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Tried using both a feature service and map image service of Pole_feat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at a total loss on what to do to get this field to autopopulate the intersecting pole. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;if (IsEmpty(Geometry($feature))) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return; // No geometry to process&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;// Find intersecting 'Pole_Intersect' features&lt;BR /&gt;&amp;nbsp; &amp;nbsp;var poleIntersects = Intersects($feature, FeatureSetByName($map, "Pole_feat"));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;/ / Check if exactly one intersecting feature is found&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if (Count(poleIntersects) == 1) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Return the value from 'wmextPole_TRMB_COMMENT' of the first intersecting feature&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return Text(First(poleIntersects).wmextPole_TRMB_COMMENT);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return "nothing";&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a screenshot of the example code from the ArcGIS Online Resources:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ExampleCode.jpg" style="width: 760px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/110635i52A77E1C0503CD8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ExampleCode.jpg" alt="ExampleCode.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2024 13:30:14 GMT</pubDate>
    <dc:creator>tthomas9</dc:creator>
    <dc:date>2024-07-25T13:30:14Z</dc:date>
    <item>
      <title>Can Not Get Calculated Expressions to Work in Forms</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510008#M60486</link>
      <description>&lt;P&gt;I was hoping someone could help me figure out the issue I am having with configuring forms in New Webmap Viewer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to configure my form to automatically fill in a field from an intersecting layer using the code from this&amp;nbsp;&lt;A href="https://doc.arcgis.com/en/arcgis-online/create-maps/create-form-mv.htm" target="_blank" rel="noopener"&gt;article on configuring forms for attribute editing.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The layer I am trying to intersect from is named 'Pole_feat' and I am trying to auto-populate my form to pull the value from the field 'wmextPole_TRMB_COMMENT'. This will save our field workers a tremendous amount of time as this value can get quite long.&lt;/P&gt;&lt;P&gt;When I test my code, &lt;STRONG&gt;it seems to work&lt;/STRONG&gt; just fine and return the value I want (please see Image 1). However, when I test it out in field maps, it will only return my else statement of "nothing" (not all poles have this value filled out, so wanted an else statement).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following:&lt;/P&gt;&lt;P&gt;-Verified both are in the same spatial reference&lt;/P&gt;&lt;P&gt;-Turned on snapping of my form's inspection feature&lt;/P&gt;&lt;P&gt;-Removed the else statement&lt;/P&gt;&lt;P&gt;-Verified the coordinates overlap (see Image 2)&lt;/P&gt;&lt;P&gt;-Tried turning on Pole_feat's popups&lt;/P&gt;&lt;P&gt;-Gave the wmextPoleT_TRMB_COMMENT an alias and tried using that&lt;/P&gt;&lt;P&gt;-Verified that the wmextPole_TRMB_COMMENT field has data (again please see Image 2)&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Tried using both a feature service and map image service of Pole_feat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at a total loss on what to do to get this field to autopopulate the intersecting pole. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;if (IsEmpty(Geometry($feature))) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return; // No geometry to process&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;// Find intersecting 'Pole_Intersect' features&lt;BR /&gt;&amp;nbsp; &amp;nbsp;var poleIntersects = Intersects($feature, FeatureSetByName($map, "Pole_feat"));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;/ / Check if exactly one intersecting feature is found&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if (Count(poleIntersects) == 1) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Return the value from 'wmextPole_TRMB_COMMENT' of the first intersecting feature&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return Text(First(poleIntersects).wmextPole_TRMB_COMMENT);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return "nothing";&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a screenshot of the example code from the ArcGIS Online Resources:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ExampleCode.jpg" style="width: 760px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/110635i52A77E1C0503CD8C/image-size/large?v=v2&amp;amp;px=999" role="button" title="ExampleCode.jpg" alt="ExampleCode.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 13:30:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510008#M60486</guid>
      <dc:creator>tthomas9</dc:creator>
      <dc:date>2024-07-25T13:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can Not Get Calculated Expressions to Work in Forms</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510048#M60489</link>
      <description>&lt;P&gt;You don't need to use &lt;STRONG&gt;Text&lt;/STRONG&gt; on a field that's already text. I would guess that in the example given, the ZIP code was a numeric field. But that's not really the issue.&lt;/P&gt;&lt;P&gt;A point-to-point intersection will need to be &lt;EM&gt;exact &lt;/EM&gt;in order to find anything. Further, geometric functions are dependent upon the &lt;EM&gt;rendered&lt;/EM&gt; shapes, so it can actually vary by view scale, etc. I would suggest putting a tiny buffer on the intersection, in case the points are actually slightly disjoint.&lt;/P&gt;&lt;PRE&gt;Intersects(Buffer($feature, 2, 'feet'), FeatureSetyByName(…))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Also, are we certain that there aren't multiple points? The way your expression is written, it will get to the "nothing" statement if the number of intersected poles is anything but 1.&lt;/P&gt;&lt;P&gt;Instead of "nothing", why not return `${Count(poleIntersects)} poles` to verify the number of intersecting poles actually found. Maybe it's not nothing, maybe it's 2?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 14:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510048#M60489</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-25T14:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can Not Get Calculated Expressions to Work in Forms</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510110#M60494</link>
      <description>&lt;P&gt;Thanks a ton for the quick response and great advice. You were correct, when I changed the code to the following:&lt;/P&gt;&lt;P&gt;if (IsEmpty(Geometry($feature))) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;return; // No geometry to process&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp;// Find intersecting 'Pole_Intersect' features&lt;BR /&gt;&amp;nbsp; &amp;nbsp;var poleIntersects = Intersects&lt;STRONG&gt;(Buffer($feature, 5, 'feet'), FeatureSetByName($map, "Pole_feat"));&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;// Check if exactly one pole&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if (Count(poleIntersects) == 1) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Return the value from 'wmextPole_TRMB_COMMENT' of the pole&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return Text(First(poleIntersects).wmextPole_TRMB_COMMENT);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt; return Count(poleIntersects) + " poles"&lt;/STRONG&gt;;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;This solved the issue! I was getting "0 Poles" as my return count until I added in that buffer code.&amp;nbsp; Thank you so much.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 15:59:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-not-get-calculated-expressions-to-work-in/m-p/1510110#M60494</guid>
      <dc:creator>tthomas9</dc:creator>
      <dc:date>2024-07-25T15:59:27Z</dc:date>
    </item>
  </channel>
</rss>

