<?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 Failed to Create Leader Line by Attribute Rules in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/failed-to-create-leader-line-by-attribute-rules/m-p/1253209#M64821</link>
    <description>&lt;P&gt;I have a junction feature class A, a feature-linked annotation B and a leader line feature class C. Now, I have implemented a attribute rule on B to auto-create leader line on C but failed. "Failed to create Connection......" is prompted after creating new point.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatsHardy_0-1675159755147.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/61672i06CA4EE3C85E3799/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MatsHardy_0-1675159755147.png" alt="MatsHardy_0-1675159755147.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Below is the code of attribute rule:&lt;/P&gt;&lt;P&gt;var anno_geom = Geometry($feature)&lt;BR /&gt;var parent_gid = $feature.FeatureGlobalID&lt;BR /&gt;var anno_gid = $feature.GlobalID&lt;/P&gt;&lt;P&gt;if (IsEmpty(parent_gid))&lt;BR /&gt;return parent_gid&lt;/P&gt;&lt;P&gt;parent_gid = Upper(parent_gid)&lt;BR /&gt;anno_gid = Upper(anno_gid)&lt;/P&gt;&lt;P&gt;var parent_fc = FeatureSetByName($datastore, "A",["GLOBALID","PS"],false)&lt;BR /&gt;var line_fc = FeatureSetByName($datastore, "C",["GLOBALID","ANNOGLOBALID","PS"],false)&lt;BR /&gt;var parent_rec = Filter(parent_fc, "GLOBALID = @parent_gid")&lt;BR /&gt;var line_rec = Filter(line_fc, "ANNOGLOBALID = @anno_gid")&lt;/P&gt;&lt;P&gt;var parent = First(parent_rec)&lt;/P&gt;&lt;P&gt;var parent_geom = Geometry(parent)&lt;/P&gt;&lt;P&gt;if (IsEmpty(parent_geom))&lt;BR /&gt;return null&lt;/P&gt;&lt;P&gt;var parent_ps = parent.PS&lt;/P&gt;&lt;P&gt;var parent_ext = Extent(parent_geom)&lt;BR /&gt;var anno_ext = Extent(anno_geom)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var endX = anno_ext['xMin']&lt;BR /&gt;var endY = anno_ext['yMin']&lt;BR /&gt;var startx = parent_ext['xMax']&lt;BR /&gt;var starty = parent_ext['yMax']&lt;/P&gt;&lt;P&gt;var maxLength = 1;&lt;/P&gt;&lt;P&gt;console(startx)&lt;BR /&gt;console(starty)&lt;BR /&gt;var leaderline = Polyline({&lt;BR /&gt;paths:[&lt;BR /&gt;[&lt;BR /&gt;[startX,startY,0],&lt;BR /&gt;[endX, endY,0]&lt;BR /&gt;]&lt;BR /&gt;],&lt;BR /&gt;hasZ: true,&lt;BR /&gt;"spatialReference": Geometry($feature)["spatialReference"]&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var att = {&lt;BR /&gt;"PS": parent_ps&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var line = First(line_rec)&lt;BR /&gt;if (IsEmpty(line)) {&lt;BR /&gt;return {&lt;BR /&gt;"result":{&lt;BR /&gt;"geometry":anno_geom,&lt;BR /&gt;"attributes": att&lt;BR /&gt;},&lt;BR /&gt;"edit": [{&lt;BR /&gt;"className": "C",&lt;BR /&gt;"adds": [{&lt;BR /&gt;"attributes": {&lt;BR /&gt;"AnnoGlobalID": anno_gid,&lt;BR /&gt;"PS": parent_ps&lt;BR /&gt;},&lt;BR /&gt;"geometry": leaderline&lt;BR /&gt;}]&lt;BR /&gt;}]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;var linegid = line.GlobalID&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;"result":{&lt;BR /&gt;"geometry":anno_geom,&lt;BR /&gt;"attributes": att&lt;BR /&gt;},&lt;BR /&gt;"edit": [{&lt;BR /&gt;"className": "C",&lt;BR /&gt;"updates": [{&lt;BR /&gt;"globalID": linegid,&lt;BR /&gt;"attributes": {&lt;BR /&gt;"AnnoGlobalID": anno_gid,&lt;BR /&gt;"PS": parent_ps&lt;BR /&gt;},&lt;BR /&gt;"geometry": leaderline&lt;BR /&gt;}]&lt;BR /&gt;}]&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 10:15:22 GMT</pubDate>
    <dc:creator>MatsHardy</dc:creator>
    <dc:date>2023-01-31T10:15:22Z</dc:date>
    <item>
      <title>Failed to Create Leader Line by Attribute Rules</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/failed-to-create-leader-line-by-attribute-rules/m-p/1253209#M64821</link>
      <description>&lt;P&gt;I have a junction feature class A, a feature-linked annotation B and a leader line feature class C. Now, I have implemented a attribute rule on B to auto-create leader line on C but failed. "Failed to create Connection......" is prompted after creating new point.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MatsHardy_0-1675159755147.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/61672i06CA4EE3C85E3799/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MatsHardy_0-1675159755147.png" alt="MatsHardy_0-1675159755147.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Below is the code of attribute rule:&lt;/P&gt;&lt;P&gt;var anno_geom = Geometry($feature)&lt;BR /&gt;var parent_gid = $feature.FeatureGlobalID&lt;BR /&gt;var anno_gid = $feature.GlobalID&lt;/P&gt;&lt;P&gt;if (IsEmpty(parent_gid))&lt;BR /&gt;return parent_gid&lt;/P&gt;&lt;P&gt;parent_gid = Upper(parent_gid)&lt;BR /&gt;anno_gid = Upper(anno_gid)&lt;/P&gt;&lt;P&gt;var parent_fc = FeatureSetByName($datastore, "A",["GLOBALID","PS"],false)&lt;BR /&gt;var line_fc = FeatureSetByName($datastore, "C",["GLOBALID","ANNOGLOBALID","PS"],false)&lt;BR /&gt;var parent_rec = Filter(parent_fc, "GLOBALID = @parent_gid")&lt;BR /&gt;var line_rec = Filter(line_fc, "ANNOGLOBALID = @anno_gid")&lt;/P&gt;&lt;P&gt;var parent = First(parent_rec)&lt;/P&gt;&lt;P&gt;var parent_geom = Geometry(parent)&lt;/P&gt;&lt;P&gt;if (IsEmpty(parent_geom))&lt;BR /&gt;return null&lt;/P&gt;&lt;P&gt;var parent_ps = parent.PS&lt;/P&gt;&lt;P&gt;var parent_ext = Extent(parent_geom)&lt;BR /&gt;var anno_ext = Extent(anno_geom)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var endX = anno_ext['xMin']&lt;BR /&gt;var endY = anno_ext['yMin']&lt;BR /&gt;var startx = parent_ext['xMax']&lt;BR /&gt;var starty = parent_ext['yMax']&lt;/P&gt;&lt;P&gt;var maxLength = 1;&lt;/P&gt;&lt;P&gt;console(startx)&lt;BR /&gt;console(starty)&lt;BR /&gt;var leaderline = Polyline({&lt;BR /&gt;paths:[&lt;BR /&gt;[&lt;BR /&gt;[startX,startY,0],&lt;BR /&gt;[endX, endY,0]&lt;BR /&gt;]&lt;BR /&gt;],&lt;BR /&gt;hasZ: true,&lt;BR /&gt;"spatialReference": Geometry($feature)["spatialReference"]&lt;BR /&gt;})&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var att = {&lt;BR /&gt;"PS": parent_ps&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var line = First(line_rec)&lt;BR /&gt;if (IsEmpty(line)) {&lt;BR /&gt;return {&lt;BR /&gt;"result":{&lt;BR /&gt;"geometry":anno_geom,&lt;BR /&gt;"attributes": att&lt;BR /&gt;},&lt;BR /&gt;"edit": [{&lt;BR /&gt;"className": "C",&lt;BR /&gt;"adds": [{&lt;BR /&gt;"attributes": {&lt;BR /&gt;"AnnoGlobalID": anno_gid,&lt;BR /&gt;"PS": parent_ps&lt;BR /&gt;},&lt;BR /&gt;"geometry": leaderline&lt;BR /&gt;}]&lt;BR /&gt;}]&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;var linegid = line.GlobalID&lt;/P&gt;&lt;P&gt;return {&lt;BR /&gt;"result":{&lt;BR /&gt;"geometry":anno_geom,&lt;BR /&gt;"attributes": att&lt;BR /&gt;},&lt;BR /&gt;"edit": [{&lt;BR /&gt;"className": "C",&lt;BR /&gt;"updates": [{&lt;BR /&gt;"globalID": linegid,&lt;BR /&gt;"attributes": {&lt;BR /&gt;"AnnoGlobalID": anno_gid,&lt;BR /&gt;"PS": parent_ps&lt;BR /&gt;},&lt;BR /&gt;"geometry": leaderline&lt;BR /&gt;}]&lt;BR /&gt;}]&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 10:15:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/failed-to-create-leader-line-by-attribute-rules/m-p/1253209#M64821</guid>
      <dc:creator>MatsHardy</dc:creator>
      <dc:date>2023-01-31T10:15:22Z</dc:date>
    </item>
  </channel>
</rss>

