<?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  Cannot read property 'length' of undefined error in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005138#M37541</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; yes this is expected it works for me in the pop up as well however when i try to calculate a field with&amp;nbsp; the same expression&amp;nbsp; it doesn't work. i shared the test map in there now but i understand you do not have the ability to calculate fields via arcade&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Nov 2020 08:24:33 GMT</pubDate>
    <dc:creator>PaulSweeney3</dc:creator>
    <dc:date>2020-11-27T08:24:33Z</dc:date>
    <item>
      <title>Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255001#M12514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See Acade expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Var polesLayer =  FeatureSetByPortalItem(Portal('myportal'), 'xxxxxxxxxx')
var chambers  = FeatureSetByPortalItem(Portal(''my portal'), 'xxxxxxxxxx')
Var buff = buffer($feature,1,'meters')
Var poles = Intersects(buff,polesLayer)
Var chambers  = Intersects(buff,chambers)
var cnt = count(poles)
var cntchambers = count(chambers) 
var popupResult = ''
for (var f in poles) {

popupResult += f.barcode + " to pole " 

}var ChambResult = ''
for (var f in chambers) {

ChambResult += f.label + " to chamber " 

}
var strLenght = count(popupResult)-8
var note = left(popupResult,strLenght)
var strLenght2 = count(ChambResult)-15
var note2 = left(ChambResult,strLenght2)
var popup = IIf(cnt==1, replace(("install subduct " + DomainName($feature,"sub_size")+ " from pole " +text(note)),'to pole',''), ("install subduct " + DomainName($feature,"sub_size")+ " from pole " +text(note)))
var popup2 = IIf(cntchambers==1, replace(("install subduct " + DomainName($feature,"sub_size")+ " from chamber " +text(note2)),'to chamber',''), ("install subduct " + DomainName($feature,"sub_size")+ " from chamber " +text(note2)))
var popup3 = "install subduct " + DomainName($feature,"sub_size")+" from the chamber "+ChambResult+" to the pole "+popupResult
var popup3 = replace(popup3,' to pole ',"")
var popup3 = replace(popup3,' to chamber ',"")
var finalresult = when(cnt &amp;lt;= 2 &amp;amp;&amp;amp; cntchambers==0,popup,cnt == 0 &amp;amp;&amp;amp; cntchambers==2, popup2,cnt == 1 &amp;amp;&amp;amp; cntchambers==1, popup3,'n/a')
return finalresult‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;i am using this expression to check if a line is intersecting two point feature layers and return an expression to run a specific type of subduct between each feature. the expression works as expected in the pop up but when i try to run it in the field calculator it fails with the expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Cannot read property 'length' of undefined error"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:35:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255001#M12514</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2021-12-11T12:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255002#M12515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/316237"&gt;Paul Sweeney&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This type of error is bound to happen if you don't include validations to see&amp;nbsp;if you have a result to work with. It probably refers to the count executed on line 6 or 7. Make sure that you have access to the two layers you retrieve using&amp;nbsp;FeatureSetByPortalItem on lines 1 and 2 and that you actually have valid poles and chambers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the pop-up it will execute only 1 example to show the result, but maybe somewhere in your data you may have an invalid feature that causes the error.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:13:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255002#M12515</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-10-28T14:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255003#M12516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3100" target="_blank"&gt;Xander Bakker&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your comments , i have added console messages to the expression and everything returns the expected results including counts in line 6 and 7 . Is it the fact that if it returns a zero in some instances that is causing the error?&amp;nbsp; i have updated the expression to return a value if the count is zero.&amp;nbsp;&amp;nbsp;I have also&amp;nbsp; filtered that table down to one feature and it is still not working on that feature even though the pop up returns the expected result. What would count as an invalid feature ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Var polesLayer =  FeatureSetByPortalItem(Portal('my portal'), 'xxxxxxx')
console('polesLayer '+polesLayer )
var chambers  = FeatureSetByPortalItem(Portal('my portal'), 'xxxxxxx')
console('chamnbers  '+chambers )

Var buff = buffer($feature,.1,'meters')
console('buff '+buff)

Var poles = Intersects(buff,polesLayer)
console('poles  '+poles )

Var chambers  = Intersects(buff,chambers)
var cnt = count(poles)
console('cnt '+cnt)
var cntchambers = count(chambers)
console('cntchambers'+cntchambers)
var popupResult = '_'
for (var f in poles) {
    if (cnt&amp;gt;0) {
        popupResult += f.barcode + " to pole " ;
    } else {
            popupResult = "There is no Link required here";
        }
}
console('popupresult '+popupResult)
var ChambResult = '_'
for (var f in chambers) {
    if (cntchambers&amp;gt;0) {
        ChambResult += f.label + " to chamber " ;
    } else {
            ChambResult = "There is no Link required here";
        }
}
console('ChambResult '+ChambResult)
var strLenght = count(popupResult)-8
console('strLenght '+strLenght)
var note = left(popupResult,strLenght)
console('note '+note)
var strLenght2 = count(ChambResult)-15
console('strLenght2 '+strLenght)
var note2 = left(ChambResult,strLenght2)
console('note2 '+note2)
var popup = IIf(cnt==1, replace(("install subduct " + DomainName($feature,"sub_size")+ " from pole " +text(note)),'to pole',''), ("install subduct " + DomainName($feature,"sub_size")+ " from pole " +text(note)))
console('popup '+popup)
var popup2 = IIf(cntchambers==1, replace(("install subduct " + DomainName($feature,"sub_size")+ " from chamber " +text(note2)),'to chamber',''), ("install subduct " + DomainName($feature,"sub_size")+ " from chamber " +text(note2)))
console('popup2 '+popup2)
var popup3 = "install subduct " + DomainName($feature,"sub_size")+" from the chamber "+ChambResult+" to the pole "+popupResult
console('popup3 '+popup3)
var popup3 = replace(popup3,' to pole ',"")
console('popup3 '+popup3)
var popup3 = replace(popup3,' to chamber ',"")
console('popup3 '+popup3)
var finalresult = when(cnt &amp;lt;= 2 &amp;amp;&amp;amp; cntchambers==0,popup,cnt == 0 &amp;amp;&amp;amp; cntchambers==2, popup2,cnt == 1 &amp;amp;&amp;amp; cntchambers==1, popup3,'n/a')
console('finalresult '+finalresult)
return finalresult‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:35:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255003#M12516</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2021-12-11T12:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255004#M12517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/316237" target="_blank"&gt;Paul Sweeney&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the late reply but I was attending the IMGIS conference and yesterday was a national holiday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just changed your code slightly, but it is still not very convincing. A couple of comments:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In your code do you have the layerID when you use FeatureSetByPortalItem for poles and chambers?&lt;/LI&gt;&lt;LI&gt;The validation of the count is before you do the loop for both poles and chambers&lt;/LI&gt;&lt;LI&gt;I am not convinced with the&amp;nbsp;final When, since there are a number of cases that in theory can occur that are probably not accounted for. See lines 88 to 98 in the code below. Are those correct?&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// does you code include the layerID for poles?&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; LayerIdPoles &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// what is the layerID for poles?&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; polesLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;  &lt;SPAN class="token function"&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Portal&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'my portal'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'xxxxxxxx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LayerIdPoles&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'polesLayer '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; polesLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// does you code include the layerID for chambers?&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; LayerIdChambers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// what is the layerID for chambers?&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; chambers  &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Portal&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'my portal'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'xxxxxxxx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; LayerIdChambers&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'chambers  '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; chambers&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// create buffer around feature of 0.1 meter&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; buff &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Buffer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0.1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'meters'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// intersect buffer with poles&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; poles &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;buff&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; polesLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;poles&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'cnt '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; cnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// intersect buffer with chambers&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; chambers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Intersects&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;buff&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; chambers&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; cntchambers &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;chambers&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'cntchambers'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; cntchambers&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popupResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// why is this an underscore?&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// validate count before the loop&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; poles&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        popupResult &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;barcode &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" to pole "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// only if you have poles, the following is relevant&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; strLenght &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;popupResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'strLenght '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; strLenght&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; note &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Left&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;popupResult&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; strLenght&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'note '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; note&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;IIf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                    &lt;SPAN class="token function"&gt;Replace&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
                        &lt;SPAN class="string token"&gt;"install subduct "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;DomainName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"sub_size"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" from pole "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; note&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                        &lt;SPAN class="string token"&gt;'to pole'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                        &lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                    &lt;SPAN class="string token"&gt;"install subduct "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;DomainName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"sub_size"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" from pole "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; note&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'popup '&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;popup&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    popupResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"There is no Link required here"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'popupresult '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; popupResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; ChambResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'_'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cntchambers&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; f &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; chambers&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        ChambResult &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; f&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;label &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" to chamber "&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;// only if you have chambers, the following is relevant&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; strLenght2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ChambResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;15&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'strLenght2 '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; strLenght&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; note2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Left&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ChambResult&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;strLenght2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'note2 '&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;note2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;IIf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cntchambers&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                    &lt;SPAN class="token function"&gt;Replace&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
                        &lt;SPAN class="string token"&gt;"install subduct "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;DomainName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"sub_size"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" from chamber "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; note2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                        &lt;SPAN class="string token"&gt;'to chamber'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                        &lt;SPAN class="string token"&gt;''&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
                    &lt;SPAN class="string token"&gt;"install subduct "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;DomainName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"sub_size"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" from chamber "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; note2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'popup2 '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; popup2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    ChambResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"There is no Link required here"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ChambResult '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; ChambResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;


&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"install subduct "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;DomainName&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$feature&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"sub_size"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; 
             &lt;SPAN class="string token"&gt;" from the chamber "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; ChambResult &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" to the pole "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; popupResult&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'popup3 '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; popup3&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Replace&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;popup3&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' to pole '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'popup3 '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; popup3&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; popup3 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Replace&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;popup3&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;' to chamber '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'popup3 '&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;popup3&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; finalresult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;When&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cnt &lt;SPAN class="operator token"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; cntchambers&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; popup&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                       cnt &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; cntchambers&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; popup2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                       cnt &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt; cntchambers&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; popup3&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                       &lt;SPAN class="string token"&gt;'n/a'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Console&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'finalresult '&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; finalresult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; finalresult&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;// 0 poles and 0 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 1 pole and 0 chambers -&amp;gt; popup&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 2 poles and 0 chambers -&amp;gt; popup&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 3 poles and 0 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 0 poles and 1 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 0 poles and 2 chambers -&amp;gt; popup2&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 0 poles and 3 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 1 pole and 1 chambers -&amp;gt; popup3&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 1 pole and 2 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 2 poles and 1 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;// 2 poles and 2 chambers -&amp;gt; 'n/a'&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is strange that&amp;nbsp;if you only have a single feature, the expression works correctly but the field calculation fails. how are you filtering the featureset? Did you create a new source? It is possible that the pop-up validator is more forgiving than the one used in the field calculation...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/255004#M12517</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T12:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1001111#M37333</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My turn to apologise for the late response , i have tried you expression and i am still getting the same error unfortunately . Just in response to some of your comments&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The when statement , in theory there should only be 2 features intersecting the line at either end and it should be a pole or a chamber so 5 potential scenarios. Would this account for the error ? where it is&amp;nbsp; only 1 pole or chamber&amp;nbsp; i don't need a value i thought this would return just 'n/a'&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;1 pole 1Pole (cnt &amp;lt;= 2 &amp;amp;&amp;amp; cntchambers==0)&lt;/LI&gt;&lt;LI&gt;1 Pole 'n/a'&lt;/LI&gt;&lt;LI&gt;1 Pole 1 chamber (cnt == 1 &amp;amp;&amp;amp; cntchambers==1)&lt;/LI&gt;&lt;LI&gt;1 chamber&amp;nbsp;1chamber (cnt == 0 &amp;amp;&amp;amp; cntchambers==2)&lt;/LI&gt;&lt;LI&gt;1 chamber&amp;nbsp;'n/a'&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// does you code include the layerID for poles?&lt;/PRE&gt;&lt;P&gt;Yes my code contains the layer ID for the poles and chambers&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;why is this an underscore?&lt;/PRE&gt;&lt;P&gt;No major reason&amp;nbsp; had it as a blank but then i thought perhaps the blank value was creating the issue so i just tried it with an underscore&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I filtered it down to one objectid i knew worked with the pop up?&lt;/P&gt;&lt;P&gt;A new source? do you mean re publish the feature layers ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help on this&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 08:26:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1001111#M37333</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2020-11-13T08:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1001412#M37343</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I guess the easiest way to clear up some doubts would be to have access to the data and track down the error. Is this a possibility? I possible create a group and share the web map and layers to that group and invite me to that group using my AGOL user "xbakker.spx".&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 21:16:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1001412#M37343</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-13T21:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1004982#M37528</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; Again apologies for the delayed response i have set up a group and added you with the layers and a map with the expression included. Please feel free to investigate if you have an opportunity , thanks for your help on this .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 09:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1004982#M37528</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2020-11-26T09:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005020#M37531</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for sharing the data. I noticed that you didn't include the web map so I don't have access to any other Arcade expression configured in the pop-up. I used the code I posted earlier and just changed to way to access the poles and chambers and this is returned in the pop-up:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1606397956463.png" style="width: 591px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/1056iBCC08A195BB7F038/image-dimensions/591x294?v=v2" width="591" height="294" role="button" title="XanderBakker_0-1606397956463.png" alt="XanderBakker_0-1606397956463.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you indicate what should be changed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 13:40:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005020#M37531</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-26T13:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005138#M37541</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; yes this is expected it works for me in the pop up as well however when i try to calculate a field with&amp;nbsp; the same expression&amp;nbsp; it doesn't work. i shared the test map in there now but i understand you do not have the ability to calculate fields via arcade&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 08:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005138#M37541</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2020-11-27T08:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005189#M37545</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me validate if I can perform the field calculation in ArcGIS Online. Can you confirm the output field name that should be filled with the result? If it does not work on ArcGIS Online, I can give it a shot and try to connect with ArcGIS Pro and perform the field calculation in Pro. Not sure if you have tried this already?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 14:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005189#M37545</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-27T14:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005556#M37555</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The field in question is "Test_Note , feel free to try, i tried previously in Pro but could not get it to work either.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 16:53:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005556#M37555</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2020-11-30T16:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005653#M37561</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will give it a shot later on and post back any results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 21:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005653#M37561</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-30T21:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005693#M37562</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No luck here either, but I think it is due to the access to the pole and chambers featuresets. To compare in the pop-up the expression worked since I can access the layers from the map by their names. However, the map is not available in a Field Calculation and the chambers and poles are not in the same datastore. That is why I assume you tried to access the layers using&amp;nbsp;FeatureSetByPortalItem. However, I don't think I am able to get access to these layers, since I am not part of the portal where the layers are stored.&lt;/P&gt;&lt;P&gt;When you try your expression in a pop-up and you access the layers using&amp;nbsp;FeatureSetByPortalItem, does the expression work, or does it return an error. I noticed the error when I try and do a Count on the layer to see if it returned something and that throws an error in my case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 22:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005693#M37562</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-30T22:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005699#M37563</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just did a test with the expression after copying the data to a local file gdb and ran the expression after changing the access by $datastore and the expression just works. It must be due to the portal access to the two layers that is causing the problem...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="XanderBakker_0-1606776387628.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/1213i8A425076C2A42545/image-size/medium?v=v2&amp;amp;px=400" role="button" title="XanderBakker_0-1606776387628.png" alt="XanderBakker_0-1606776387628.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 22:47:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1005699#M37563</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-11-30T22:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Expression  Cannot read property 'length' of undefined error</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1007715#M37645</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;it is working for me now and the good news is the pop up is working in the field maps app so i can use it in that for our field crews. Really appreciate the help on this , I&amp;nbsp; applaud your efforts to support everyone on this page with arcade quieres&amp;nbsp; it really is very helpful. Well done.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 15:21:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-expression-cannot-read-property-length-of/m-p/1007715#M37645</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2020-12-08T15:21:42Z</dc:date>
    </item>
  </channel>
</rss>

