<?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 calculation : how to wait for the end of a geometry in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1399173#M8171</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/27821"&gt;@DISIG&lt;/a&gt;&amp;nbsp; - thanks for sharing all the detail.&amp;nbsp; The Field Maps create new feature edit experience doesn't really have the concept of "&lt;SPAN&gt;end of the complete geometry&lt;/SPAN&gt;" as vertices are added to the polyline that will trigger calculated values to update.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the primary issue the calculations execution time as vertices are added/updated?&amp;nbsp; Perhaps it's a distraction to the field worker using the form?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Couple suggestions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;display the calculated field's value in the popup and hide it in the editing form&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;use a &lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/get-the-true-vertex-count-arcade/idi-p/1148911" target="_self"&gt;vertex count&amp;nbsp;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Length&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;'meters'&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;; to ensure the line meets a certain criteria before calculating&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Hope that helps-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jake Brown &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Field App Product Engineer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 17:50:50 GMT</pubDate>
    <dc:creator>JakeBrownMaps</dc:creator>
    <dc:date>2024-03-21T17:50:50Z</dc:date>
    <item>
      <title>Arcade attribute calculation : how to wait for the end of a geometry</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1398884#M8161</link>
      <description>&lt;P&gt;hello everybody i am migrating to fieldmaps an arcade calculation that work perfectly in the map viewer and pro.&lt;/P&gt;&lt;P&gt;the subject of this calculation is&amp;nbsp; : spatially catching the attribute of an other layer BUT based on the majoritary representation in multiple intersections case.&lt;/P&gt;&lt;P&gt;when calculating in fieldmaps seems not wait the end of the complete geometry before calculating.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;console('STATUT : EN PRODUCTION')
console('TITRE : extraire atribut relation spatiale')
console('CLC-ATTR-HERIT-SPA')
console('2024-02-28 Version 1.0 ')
// VARIABLES UTILISATEURS
var t = 50; // tolérance maximale de recherche exprimée en mètres
var G = $feature // G pour géométrie source
var P = buffer($feature,t,'meters'); // P pour entité de type polygone
var L = FeatureSetByName($map, "ROUTES_POUR_PR") // L pour layer dont on veut l'attribut majoritaire
var A = 'ROUTE' // A pour attribut à retourner

// STEP1 : AJUSTEMENT DE LA DISTANCE DE TRAITEMENT
var I = Intersects(L,P) // I pour Intersection
if(isempty(I) || count(I)==0){return '+ de '+t+ 'mètres'}
var adjustedDistance     = Infinity;
  // On cherche le plus proche pour calculer sa distance
  for (var sEnt in I){
    var DynDistance = Distance(sEnt,G, "meters");
    if(DynDistance &amp;lt; adjustedDistance){
      adjustedDistance = DynDistance;
    }
  };
if(adjustedDistance==0){adjustedDistance+=1}

// STEP : 2  ADAPTATION DE LA GÉOMETRIE SOURCE
if(typeof(geometry(G))=='Polyline'|| typeof(geometry(G))=='Point')
    {P = buffer(G,adjustedDistance,'meters')
    console('P est une ligne ou un point')};
if(typeof(geometry(G))=='Polygon')
    {P = G
    console('P est un polygone')};

// STEP 3 : TRAITEMENT DES CAS D'INTERSECTION UNIQUES.
if(isempty(I)||count(I)==0){return '-'};
if(count(I)==1){
var candidat = first(I)[A]
if(right(candidat,2)=='PG'){return replace(candidat,'PG','')}else{return candidat}
};

// STEP 4  : TRAITEMENT DES CAS D'INTERSECTION MULTIPLES.
var features = [];
var feat;
for (var eEnt in I){
  var tmpG = clip(eEnt,extent(P))
  var Geom = Buffer(tmpG,adjustedDistance,'meters')
  var gArea = Area(Intersection(P,Geom),'meters')
  var gAttr = eEnt[A]
  feat = {'attributes': {'inheritedAttr': Text(gAttr),'representation': Number(gArea),}}
    Push(features, feat);

}
var dowDict = { 
  'fields': [{ 'name': 'inheritedAttr', 'type': 'esriFieldTypeString'},
  {'name': 'representation', 'type': 'esriFieldTypeDouble'}], 
  'geometryType': '', 
  'features': features
};
var candidat = first(orderBy(FeatureSet(dowDict),'representation DESC'))['inheritedAttr']
if(right(candidat,2)=='PG'){return replace(candidat,'PG','')}else{return candidat}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 09:33:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1398884#M8161</guid>
      <dc:creator>DISIG</dc:creator>
      <dc:date>2024-03-21T09:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade attribute calculation : how to wait for the end of a geometry</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1399173#M8171</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/27821"&gt;@DISIG&lt;/a&gt;&amp;nbsp; - thanks for sharing all the detail.&amp;nbsp; The Field Maps create new feature edit experience doesn't really have the concept of "&lt;SPAN&gt;end of the complete geometry&lt;/SPAN&gt;" as vertices are added to the polyline that will trigger calculated values to update.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the primary issue the calculations execution time as vertices are added/updated?&amp;nbsp; Perhaps it's a distraction to the field worker using the form?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Couple suggestions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;display the calculated field's value in the popup and hide it in the editing form&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;use a &lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/get-the-true-vertex-count-arcade/idi-p/1148911" target="_self"&gt;vertex count&amp;nbsp;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Length&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;'meters'&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;; to ensure the line meets a certain criteria before calculating&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Hope that helps-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Jake Brown &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Field App Product Engineer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 17:50:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1399173#M8171</guid>
      <dc:creator>JakeBrownMaps</dc:creator>
      <dc:date>2024-03-21T17:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade attribute calculation : how to wait for the end of a geometry</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1410792#M8372</link>
      <description>&lt;P&gt;Hello Jake, thank you for your answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was just a simple projection problem. This kind of geometrical calculations seems to work in FieldMaps if the projections of all the layers are the sames. (&lt;SPAN class=""&gt;BUG&lt;/SPAN&gt;&lt;SPAN&gt;-000133986)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I reprojected my all layers and everything is working perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;A good step to ready-to-use data &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 08:53:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-attribute-calculation-how-to-wait-for-the/m-p/1410792#M8372</guid>
      <dc:creator>DISIG</dc:creator>
      <dc:date>2024-04-17T08:53:14Z</dc:date>
    </item>
  </channel>
</rss>

