<?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 Expression works in Map Viewer but not Field Maps in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391139#M8059</link>
    <description>&lt;P&gt;Checking null works, at least in other contexts. Wouldn't be the first time there was a notable discrepancy between one version of Arcade and another, though.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2024 15:19:00 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2024-03-05T15:19:00Z</dc:date>
    <item>
      <title>Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1390836#M8050</link>
      <description>&lt;P&gt;I have an arcade expression that works perfectly fine in Map Viewer but when I access the map in Field Maps it always returns "&lt;SPAN&gt;No closest weather station was found within the search distance".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any help on why this is would be greatly appreciated.&lt;/P&gt;&lt;P&gt;The expression is below:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;searchDistance&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;50&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// Search distance in kilometers&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;weatherStations&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Portal&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;A href="https://www.arcgis.com" target="_blank" rel="noopener"&gt;https://www.arcgis.com&lt;/A&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'38406bada3104e258fc8b42a2a96581a'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN&gt;'Temperature_C'&lt;/SPAN&gt;&lt;SPAN&gt;],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;proximityWeatherStations&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Intersects&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;weatherStations&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;Buffer&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;searchDistance&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"kilometers"&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Infinity&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;closestWeatherStationTemp&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;f&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;proximityWeatherStations&lt;/SPAN&gt;&lt;SPAN&gt;){&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;weatherDist&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Round&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Distance&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"kilometers"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;weatherDist&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;closestWeatherStationTemp&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"Temperature_C"&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;weatherDist&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Check if a closest individual weather station was found before accessing its property&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;closestWeatherStationTemp&lt;/SPAN&gt;&lt;SPAN&gt; != &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;"Closest Weather Station Temperature is: "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;closestWeatherStationTemp&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;" degrees C and is located approximately "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;Round&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;" km away."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;"No closest weather station was found within the search distance."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Mar 2024 00:05:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1390836#M8050</guid>
      <dc:creator>ChrisJRoss13</dc:creator>
      <dc:date>2024-03-05T00:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391102#M8052</link>
      <description>&lt;P&gt;Are you offline when you use Field Maps? This expression would require access to the internet in order to get information from the weatherStations featureset.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 14:38:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391102#M8052</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-03-05T14:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391103#M8053</link>
      <description>&lt;P&gt;Yes, all online. I am aware that when you move offline that this functionality does not work.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 14:40:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391103#M8053</guid>
      <dc:creator>ChrisJRoss13</dc:creator>
      <dc:date>2024-03-05T14:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391107#M8054</link>
      <description>&lt;P&gt;I think it is from using FeatureSetbyProtalID.&amp;nbsp; Change to FeatureSetByName and use the name from the map.&amp;nbsp; See if that does it.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 14:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391107#M8054</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-03-05T14:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391109#M8055</link>
      <description>&lt;P&gt;The actual hosted feature layer is not contained in the map therefore I cannot use the &lt;STRONG&gt;FeatureSetByName&lt;/STRONG&gt;. I have another expression that pulls property information (not contained in the map) that uses &lt;STRONG&gt;FeatureSetByPortalID&lt;/STRONG&gt; and it works fine.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 14:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391109#M8055</guid>
      <dc:creator>ChrisJRoss13</dc:creator>
      <dc:date>2024-03-05T14:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391110#M8056</link>
      <description>&lt;P&gt;Curious. I don't see anything obvious in the expression otherwise. We use "FeatureSetByPortalID" functions in Field Maps without issue, but it may be worth adding the layer to the map and testing&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/16421"&gt;@DougBrowning&lt;/a&gt; 's suggestion just to see.&lt;/P&gt;&lt;P&gt;Are you testing in Field Maps with the same login as you use in the Map Viewer? Could it be a sharing permission set on the absent layer?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 14:50:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391110#M8056</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-03-05T14:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391135#M8058</link>
      <description>&lt;P&gt;Ok next idea is this line&amp;nbsp;&amp;nbsp;(closestWeatherStationTemp != null)&amp;nbsp; &amp;nbsp;change to isEmpty&amp;nbsp; &amp;nbsp;Not sure just null works?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 15:16:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391135#M8058</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-03-05T15:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391139#M8059</link>
      <description>&lt;P&gt;Checking null works, at least in other contexts. Wouldn't be the first time there was a notable discrepancy between one version of Arcade and another, though.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 15:19:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391139#M8059</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-03-05T15:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391149#M8061</link>
      <description>&lt;P&gt;Not sure what declaring a var with no value does even?&amp;nbsp; It would not even have a type?&amp;nbsp; Maybe set it to '' instead then check that.&lt;/P&gt;&lt;P&gt;I would use Console and see what&amp;nbsp;closestWeatherStationTemp is getting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 15:32:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391149#M8061</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-03-05T15:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391155#M8062</link>
      <description>&lt;P&gt;Correct, it's just a null, no type. Makes it easier to later just assign values without declaring it over and over inside the loop.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 15:38:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391155#M8062</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-03-05T15:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391378#M8069</link>
      <description>&lt;P&gt;I modified the code slightly and checked into a few things.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The null check doesn't make any impact.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;closestWeatherStationTemp&amp;nbsp;grabs the temperature of the specific station.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I tested adding the hosted feature layer to the map and comparing FeatureSetByName and FeatureSetByPortalID. The FeatureSetByName option works in Field Map.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I've attached the same selected feature in AGOL map viewer and field maps showing reference to ByPortalID and ByName.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;My most recent code is:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Define search parameters&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;searchDistanceKm&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;50&lt;/SPAN&gt;&lt;SPAN&gt;; &lt;/SPAN&gt;&lt;SPAN&gt;// Search distance in kilometers&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Access weather stations from the Living Atlas&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Source: Environment Canada dataset&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;weatherStationsFS&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;Portal&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://www.arcgis.com" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"38406bada3104e258fc8b42a2a96581a"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;// Item ID for the dataset&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;// Layer index&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN&gt;"Temperature_C"&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;// Attributes to include&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt; &lt;SPAN&gt;// Spatial filtering flag&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Find weather stations within the search distance&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;nearbyWeatherStations&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Intersects&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;weatherStationsFS&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;Buffer&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;searchDistanceKm&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"kilometers"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Initialize variables to track the closest station&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Infinity&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;closestStationTemperature&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Iterate through nearby stations to find the closest one&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;station&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;nearbyWeatherStations&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;distanceToStation&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Round&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Distance&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;station&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"kilometers"&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;distanceToStation&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;closestStationTemperature&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;station&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"Temperature_C"&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;distanceToStation&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Output the result based on whether a close station was found&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;closestStationTemperature&lt;/SPAN&gt;&lt;SPAN&gt; != &lt;/SPAN&gt;&lt;SPAN&gt;null&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;"Closest Weather Station Temperature is "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;closestStationTemperature&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;"°C and is located approximately "&lt;/SPAN&gt;&lt;SPAN&gt; + &lt;/SPAN&gt;&lt;SPAN&gt;Round&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;minDistance&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;" km away."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;} &lt;/SPAN&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;"No closest weather station was found within the search distance."&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Mar 2024 19:11:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1391378#M8069</guid>
      <dc:creator>ChrisJRoss13</dc:creator>
      <dc:date>2024-03-05T19:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression works in Map Viewer but not Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1617840#M10879</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/104591"&gt;@ChrisJRoss13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To confirm using the&amp;nbsp;&lt;SPAN&gt;FeatureSetByName resolved the issue for you?&lt;BR /&gt;&lt;BR /&gt;I am seeing a similar issue that I am troubleshooting now,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2025 04:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-expression-works-in-map-viewer-but-not/m-p/1617840#M10879</guid>
      <dc:creator>AlexHogan</dc:creator>
      <dc:date>2025-05-23T04:47:19Z</dc:date>
    </item>
  </channel>
</rss>

