<?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 Arcade behaves differently in enterprise database attribute rules vs Field Maps field calculations in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-behaves-differently-in-enterprise-database/m-p/1521866#M87003</link>
    <description>&lt;P&gt;I'm creating a workflow with a several access points (Pro, Web App, Field Maps) and am trying to use attribute rules (where possible) and field calculations (where attribute rules don't work) to calculate a unique record ID.&amp;nbsp; One thing to note is that the Pro or Web App interface accesses one DB while the Field Maps interface accesses a different DB with a replica synchronizing between the two.&amp;nbsp; The record ID looks at the intersection of several datasets to calculate the ID as a point feature is created.&amp;nbsp; The arcade will will return the features from two polygon datasets that intersect the point feature being created.&amp;nbsp; Then it will use one of the polygon features to determine how many other point features are contained within to get a count.&amp;nbsp; Then the ID is created using attribute values from the two polygon datasets and the count (increased by one).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm running into is that the code seems to behave differently in attribute rules vs field calculation.&amp;nbsp; In field maps, everything works as expected using field calculations. When I add a point to within any polygon, the ID increments correctly regardless of whether any points already exist within the polygon.&amp;nbsp; When working in Pro or a Web App (attribute rules), if I try to add a new point where other points already exist within the polygon, everything works fine the the ID is incremented correctly.&amp;nbsp; However, if there are no existing points within the polygon, the initial ID increments one too many (the numbering starts at 2 instead of 1), but subsequent IDs follow the lead of the first and increment correctly from there(3...4...5...and so on).&amp;nbsp; This last part is weird because the arcade never looks at any of the IDs within the polygon, it only looks at the number of points.&lt;/P&gt;&lt;P&gt;I use the same code for the attribute rules and the field calculations, only changing how the feature set is referenced.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the attribute rules I reference the feature sets by $datastore and use the DB name for the dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample language-javascript"&gt;&lt;CODE&gt;var Poly1 = First(Intersects($feature,  FeatureSetByName($datastore,'DataOwner.poly1_DB_Name')))
var poly2 = First(Intersects($feature,  FeatureSetByName($datastore,'DataOwner.poly2_DB_Name')))
if (poly1==null) return "no poly1 found"
if (poly2==null) return "no poly2 found"
var PointCount = SUM(Count(Intersects(poly2,FeatureSetByName($datastore, 'DataOwner.point_DB_Name'))),1)
var PointCountFormat = Text(PointCount,'00')
var PointID = poly1['Att1']+poly1['Att2']+poly2['Att1']+PointCountFormat
return PointID&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the Field Maps field calculation I reference the feature set by $map and use the map name of the dataset :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample language-javascript"&gt;&lt;CODE&gt;var poly1 = First(Intersects($feature, FeatureSetByName($map,'poly1_Map_Name')))
var poly2 = First(Intersects($feature,  FeatureSetByName($map,'poly2_Map_Name')))
if (poly1==null) return "no poly1 found"
if (poly2 ==null) return "no poly2 found"
var PointCount = SUM(Count(Intersects(poly2 ,FeatureSetByName($map, 'point_Map_Name'))),1)
var PointCountFormat = Text(PointCount,'00')
var PointID = poly1['Att1']+poly1['Att2']+poly2 ['att1']+PointCountFormat
return PointID&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could this be a problem of timing differences between when DB attribute rules fire off vs Field Maps field calculations?&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2024 22:16:15 GMT</pubDate>
    <dc:creator>ShareUser</dc:creator>
    <dc:date>2024-08-14T22:16:15Z</dc:date>
    <item>
      <title>Arcade behaves differently in enterprise database attribute rules vs Field Maps field calculations</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-behaves-differently-in-enterprise-database/m-p/1521866#M87003</link>
      <description>&lt;P&gt;I'm creating a workflow with a several access points (Pro, Web App, Field Maps) and am trying to use attribute rules (where possible) and field calculations (where attribute rules don't work) to calculate a unique record ID.&amp;nbsp; One thing to note is that the Pro or Web App interface accesses one DB while the Field Maps interface accesses a different DB with a replica synchronizing between the two.&amp;nbsp; The record ID looks at the intersection of several datasets to calculate the ID as a point feature is created.&amp;nbsp; The arcade will will return the features from two polygon datasets that intersect the point feature being created.&amp;nbsp; Then it will use one of the polygon features to determine how many other point features are contained within to get a count.&amp;nbsp; Then the ID is created using attribute values from the two polygon datasets and the count (increased by one).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm running into is that the code seems to behave differently in attribute rules vs field calculation.&amp;nbsp; In field maps, everything works as expected using field calculations. When I add a point to within any polygon, the ID increments correctly regardless of whether any points already exist within the polygon.&amp;nbsp; When working in Pro or a Web App (attribute rules), if I try to add a new point where other points already exist within the polygon, everything works fine the the ID is incremented correctly.&amp;nbsp; However, if there are no existing points within the polygon, the initial ID increments one too many (the numbering starts at 2 instead of 1), but subsequent IDs follow the lead of the first and increment correctly from there(3...4...5...and so on).&amp;nbsp; This last part is weird because the arcade never looks at any of the IDs within the polygon, it only looks at the number of points.&lt;/P&gt;&lt;P&gt;I use the same code for the attribute rules and the field calculations, only changing how the feature set is referenced.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the attribute rules I reference the feature sets by $datastore and use the DB name for the dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample language-javascript"&gt;&lt;CODE&gt;var Poly1 = First(Intersects($feature,  FeatureSetByName($datastore,'DataOwner.poly1_DB_Name')))
var poly2 = First(Intersects($feature,  FeatureSetByName($datastore,'DataOwner.poly2_DB_Name')))
if (poly1==null) return "no poly1 found"
if (poly2==null) return "no poly2 found"
var PointCount = SUM(Count(Intersects(poly2,FeatureSetByName($datastore, 'DataOwner.point_DB_Name'))),1)
var PointCountFormat = Text(PointCount,'00')
var PointID = poly1['Att1']+poly1['Att2']+poly2['Att1']+PointCountFormat
return PointID&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And in the Field Maps field calculation I reference the feature set by $map and use the map name of the dataset :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample language-javascript"&gt;&lt;CODE&gt;var poly1 = First(Intersects($feature, FeatureSetByName($map,'poly1_Map_Name')))
var poly2 = First(Intersects($feature,  FeatureSetByName($map,'poly2_Map_Name')))
if (poly1==null) return "no poly1 found"
if (poly2 ==null) return "no poly2 found"
var PointCount = SUM(Count(Intersects(poly2 ,FeatureSetByName($map, 'point_Map_Name'))),1)
var PointCountFormat = Text(PointCount,'00')
var PointID = poly1['Att1']+poly1['Att2']+poly2 ['att1']+PointCountFormat
return PointID&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could this be a problem of timing differences between when DB attribute rules fire off vs Field Maps field calculations?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 22:16:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-behaves-differently-in-enterprise-database/m-p/1521866#M87003</guid>
      <dc:creator>ShareUser</dc:creator>
      <dc:date>2024-08-14T22:16:15Z</dc:date>
    </item>
  </channel>
</rss>

